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