How do I change a field name in a collection in mongodb -


{ "_id" : objectid("531df10dc044701691c55acf"), "name" : "jrose", "phonenumbers" : [     {         "type" : "home",         "value" : "7707446895"     },     {         "type" : "work",         "value" : "7707336895"     }], "callerid" : ["7707336895"], "pin" : "7707336895", "usesms" : true } 

i want change "value" field "phonenumber" inside of "phonenumbers" array

seems $rename operator doesn't work arrays (at moment).

> db.foo.update({}, {$rename: {'phonenumbers.value': 'phonenumbers.phonenumber'}}) $rename source field invalid 

so choice read document, modify in application , rewrite in database.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -