update lacking positional match creates bad document

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 2.3.2
    • Affects Version/s: 2.0.6, 2.2.0-rc0
    • Component/s: Write Ops
    • None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      If there is no array match in the query portion of an update, any $ field name is copied directly to the result document.

      c = db.c;
      c.drop();
      
      c.save( {} );
      c.update( {}, { $set:{ 'a.$':5 } } );
      printjson( c.findOne() );
      

      result

      { "_id" : ObjectId("501840bc20fa57fe9c46e970"), "a" : { "$" : 5 } }
      

              Assignee:
              Aaron Staple (Inactive)
              Reporter:
              Aaron Staple (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: