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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Write Ops
    • None
    • ALL

    Description

      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().

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: