1

If one has a collection of objects that look like this:

{
    name:"some name",
    dob:"april 4, 1985",
    address:{
        street:"some street",
        city:"some city",
    }
}

...can $set be used to update just the city?

user1505103
  • 33
  • 1
  • 4

1 Answers1

0

This query should do it for you:

Collection.update({sel}, {"$set" : {"address.city": "new city"}})
debergalis
  • 11,870
  • 2
  • 49
  • 43
fraherm
  • 671
  • 2
  • 11
  • 21