Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6669

update lacking positional match creates bad document

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

      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 Aaron Staple
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: