$set with array indexes

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Minor - P4
    • 1.3.0
    • Affects Version/s: None
    • Component/s: Write Ops
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      [fcoury@imac 17:47]:$ mongo
      MongoDB shell version: 0.9.6
      url: test
      connecting to: test
      type "help" for help
      > db.sample.remove();
      > db.sample.save({"_id" : "db1940364a68bbca000000a1" , "test" : [

      {"name" : "domain" , "default" : "" , "validation" : "" , "validation_error" : "" , "label" : "Domain" , "required" : false}

      ]})
      > db.sample.update(

      {"_id":"db1940364a68bbca000000a1"}

      , {$set: {"test.0.new_attribute": "new_value"}})
      > db.sample.find();
      {"_id" : "db1940364a68bbca000000a1" , "test" : [

      {"name" : "domain" , "default" : "" , "validation" : "" , "validation_error" : "" , "label" : "Domain" , "required" : false}

      ]}

              Assignee:
              Eliot Horowitz (Inactive)
              Reporter:
              Eliot Horowitz (Inactive)
              Votes:
              6 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: