I have an object with this model:
var schema = new db.Schema({
user : { type: db.Schema.ObjectId, ref: 'user' },
friend: { type: db.Schema.ObjectId, ref: 'user' },
options : [option],
created_on: Date
});
var option = new db.Schema({
key: String,
value: String
},{ _id : false });
the default options are:
this.options = [
{ 'key':'accepted','value':false },
{ 'key':'enable','value':false },
....
];
for change one of this options I make a query/update like this:
query['to_options.key'] = req.body.key;
update['to_options.$.value'] = req.body.value;
but how can I change more then one object?I need to make more then one query?