hello,everyone,i have similar following data
{
_id,
....
items:[
{
id:1,
....
},
{
id:2
....
}
]
}
now,i want to delete the
items.id=1 and return the other remain items .
my code like this:
var update = Update.Pull("items", Query.EQ("id",1"));
var fields = Fields.Include(new string[] { "_id", "items" });
var result=this.Collection.FindAndModify(query, SortBy.Null, update, fields, true, false);
when i runing the above code,i get the error.
Command 'findAndModify' failed: E11000 duplicate key error index: tobobay_prods.products.$items.id_1 dup key: { : null } (response: { "lastErrorObject" : { "err" : "E11000 duplicate key error index: tobobay_prods.products.$items.id_1 dup key: { : null }", "code" : 11001, "n" : 0, "connectionId" : 52, "ok" : 1.0 }, "
someone can give me some suggestion?how Pull some item and return entire data?
thanks.