0

I want to run this command

db.hospitals.update( { "coordinates.lng": { $lt: -9.034882 } , display:1 },
                    { $set: {"coordinates.lng":{$inc : 0.75}}},
                    { multi: true }
                  )

All I get is : not okForStorage coordinates is an embedded document and this is its structure :

coordinates{
  lat:
  lg:
}

As requested

db.hospitals.findOne()
{
        "_id" : ObjectId("52ae09f8211b6f57548b4568"),
        "active" : 0,
        "author" : "52cb29b0211b6fd9248b456b",
        "coordinates" : {
                "lat" : 35.691048,
                "lng" : 139.701065
        },
        "date" : ISODate("2013-10-24T18:41:42Z"),
       "display" : 0

}

Help please !

Aysennoussi
  • 3,720
  • 3
  • 36
  • 60

1 Answers1

4
{ $set: {"coordinates.lng": {$inc: 0.75}}}

This is not how you $inc a field. ^ Do this instead:

{ $inc: {"coordinates.lng": 0.75}}
Sergio Tulentsev
  • 226,338
  • 43
  • 373
  • 367