i met a problem about mongodb.
db.tt.find()
{ "_id" : ObjectId("513c971be4b1f9d71bc8c769"),
"name" : "a",
"comments" : [ { "name" : "2" }, { "name" : "3" } ]
}
above is a test document.
i want to pull comments.name = 2
i do
db.tt.update({'comments.name':'2'},{'$pull':{'comments.$.name':'2'}});
but the console print these message:
Cannot apply $pull/$pullAll modifier to non-array
my mongodb version is 2.0.6
who can help me? Thank you very much