I have the following in mongoDB:
{ "_id" : ObjectId("552f4bf5344fbaee0f62ccef"), "name" : "testcase2", "steps" : [ { "spec1" : "postPet" }, { "spec2" : "putPet" }, { "spec2" : "getPetsHistory" } ] }
I want to pull an element from an array of steps. I can use only the following values: "testcase2", "postPet".
I used regex in the update request, as described in the following link: https://gist.github.com/gatesvp/1021164
My request:
db.testcaseCollection.update({"name" : "testcase3"}, {$pull : {"steps" : {$regex: 'postPet'}}})
and the result:
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 0 })
Can someone help with what I'm doing wrong?
source share