API exemple avec collection MongoDB étudiants
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

50 lines
927 B

var mongoose = require('mongoose'); // Setup schema
var etudiantSchema = mongoose.Schema({
numEtudiant: {
type: String,
required: true
},
firstname: {
type: String,
required: true
},
lastname: {
type: String,
required: true
},
cycle: {
type: Number,
required: true
},
adresse: {
num: {
type: Number
},
rue: {
type: String
},
ville: {
type: String
},
pays: {
type: String
}
},
email: {
type: [String]
},
cours: []
},
{
collection : 'etudiant'
}
);
// Export Etudiant model
var Etudiant = module.exports = mongoose.model('etudiant', etudiantSchema);
module.exports.get = function (callback, limit) {
Etudiant.find(callback).limit(limit);
}