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); }