var BlogPost = new Schema({
author : ObjectId
, title : String
, body : String
, date : Date
, comments : [Comments]
, meta : {
votes : Number
, favs : Number
}
});
var Person = new Schema({
title : { type: String, required: true }
, age : { type: Number, min: 5, max: 20 }
, meta : {
likes : [String]
, birth : { type: Date, default: Date.now }
}
});
--
http://mongoosejs.com
http://github.com/learnboost/mongoose
You received this message because you are subscribed to the Google
Groups "Mongoose Node.JS ORM" group.
To post to this group, send email to mongoo...@googlegroups.com
To unsubscribe from this group, send email to
mongoose-orm...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/mongoose-orm?hl=en
var Image = new Schema({
caption : String
, dimensions: {
width : Number
, height : Number
}
});
var Image = new Schema({ caption : String , versions : [{name : String width : Number , height: Number}] });
Why is that? Something about an array means you can't listen for changes inside it without wrapping it with schema?
Would probably be a good idea to call this out in big bright letters somewhere in the docs. This is ultra sad nuance magic. Burying such an obvious use case on the schema types page is bad form.