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

conflicting mods not always detected, update implementation can create a doc with dup field names if not detected

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

      The code for detecting conflicting mods does not always detect conflicting mods. In cases where conflicting mods are not detected, the update implementation does not handle the conflicting mods properly and can create a document with duplicate field names.

      Test

      c = db.c;
      c.drop();
      
      c.save( {} );
      
      // This triggers an error.                                                                 
      c.update( {}, { $set:{ 'a.b':2, 'a.b.c':3 } } );
      printjson( db.getLastError() );
      
      // This generates { a:{ a:1, b:2, b:2 } }.                                                        
      c.update( {}, { $set:{ 'a.a':1, 'a.b':2, 'a.b.c':3 } } );
      printjson( db.getLastError() );
      printjson( c.find().toArray() );
      

      See ModSet::haveConflictingMod().

            Assignee:
            Unassigned Unassigned
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: