Update MongoDB field using value of another field -


in mongodb, possible update value of field using value field? equivalent sql like:

update person set name = firstname + ' ' + lastname 

and mongodb pseudo-code be:

db.person.update( {}, { $set : { name : firstname + ' ' + lastname } ); 

you cannot refer document in update (yet). you'll need iterate through documents , update each document using function. see this answer example, or this one server-side eval().


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? -