I have the following scheme:
Day = new Schema({
day: String,
hours: [{
hour: String,
items: [{
item: {
title: String,
...
}
}]
}]
});
I'm trying to fill it like this:
hour = {hour:'11', items:[{title:'blablabla'}]};
models.Day.update(day, {$push: {hours:hour}}, {upsert:true}, function(err){
// ...
});
The problem is I get everything work except items is array with empty objects: only field '_id' is present, but 'title' and others are not there.
> db.days.findOne()
{
"_id" : ObjectId("53fdcff6a62c21b2358b7c7f"),
"day" : "2014.08.27",
"hours" : [
{
"hour" : "16",
"_id" : ObjectId("53fdcff6c250ce0000dd75d3"),
"items" : [
{
"_id" : ObjectId("53fdcff6c250ce0000dd75d6")
},
{
"_id" : ObjectId("53fdcff6c250ce0000dd75d5")
},
]
}
]
}
Why it's not working?
P.S. Sorry for my english...