$in is not working in Mongodb -


this question has answer here:

i have 2 documents "name" values "raja_5" , "raja_6". have written following codes update city in 2 documents.

collection.update({"name":{"$in":["raja_5","raja_6"]}},{"$set":{"city":"hyd"}}) 

(or)

collection.update({"$or":[{"name":"raja_5"},{"name":"raja_6"}]},{"$set":{"city":"hyd"}}) 

but document "raja_5" getting updated not other document in both cases.

please me.

the following code working now

collection.update({     "name": {     "$in": ["raja_5", "raja_6"]     }   }, {     "$set": {     "city": "hyd"     }   }, "false", "true") 

Comments