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.
 
 

32 lines
631 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
}
},
{
collection : "etudiant"
}
);
// Export Etudiant model
var Etudiant = module.exports = mongoose.model('etudiant', etudiantSchema);
module.exports.get = function (callback, limit) {
Etudiant.find(callback).limit(limit);
}