I have a database of users like in the example below and I need to update the city of the user from Bonn to Berlin.
{
"_id" : "Louis",
"registered" : true,
"likes" : [
"tennis",
"cooking"
],
"addr" : {
"city" : "Bonn",
"country" : "Germany"
}
}
I have tried the following but it does not seem to work. Any ideas?
db.users.update( {_id:"Louis"}, {$set:{city:"Berlin"}} )