mongodb - Mongo record not updating, no error either -


here record want update:

{     "_id" : objectid("519177384e2e9fee10000000"),     "fb_id" : { "0" : "2000" },     "name" : { "0" : "aaa bbb" },     "email" : { "0" : "abc@abc.com" } } 

i fb_id changed "2000", instead of { "0" : "2000" }.

i tried..

primary> db.users.update({fb_id : "{ 0 : 2000 }"},{$set: {fb_id: "2000"}}); 

it did not work did not through error either. doing wrong?

you need move double quotes:

db.users.update({fb_id : { "0" : "2000" }},{$set: {fb_id: "2000"}}) 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -