Mongo update new field with value from old field

1.1k Views Asked by At

What is the command to update a mongo collection. I have a variable id and key and the key is newly introduced. I want to update each document in the mongo collection by writing a new variable "key" that has the same value as "id"

So far I have

db.collectionname.update({}, ,{multi:true})

Sorry, I'm new to mongo and would appreciate some good study/reading material

Thanks

0

There are 0 best solutions below