I have found this tutorial: http://dailyjs.com/2010/12/06/node-tutorial-5/
which uses a slightly different approach from build model schemas then the mongoosejs.com docs.
It doesn't creates the MongooseModel with help of mongoose.Schema:
var Some = mongoose.model('Some', new mongoose.Schema({
property: { Type: String }
}), 'Somes');
but with something like:
var Some = mongoose.model('Some', {
setters: {
toLowerCase: function(string) {
return string.toLowerCase();
}
}
}, 'Somes');
I personally have less issues with the second method and can read better in. Unfortunatly there isn't any information about this approach in the docs...
Have there some already experience with this way to define mongoose models? Where do I find more docs about?
Regards
Hmm I haven't seen this notation, and it may well be completely outdated syntax looking at the post date (06 Dec 2010)
The relevant part (although perhaps a bit sparse) in the documentation: http://mongoosejs.com/docs/getters-setters.html
Note that this doesn't mean you don't have to define your schema anymore, setters (and getters) are there to augment the model where needed.
hth