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

different dup dropping semantics with background vs non background indexing

    XMLWordPrintableJSON

Details

    • Icon: Question Question
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      Non background index build -

      {a:[2,3]}

      document is partially indexed before being dropped at the end of the index build. As a result,

      {a:2}

      document is also marked as a dup and dropped.

      > c.drop()
      true
      > c.save( {a:3} );
      > c.save( {a:[2,3]} );
      > c.save( {a:2} );
      > c.ensureIndex( {a:1}, {unique:true,dropDups:true} )
      > c.find()
      { "_id" : ObjectId("4f277e3e2e17f5bc7039cd20"), "a" : 3 }

      Background index build -

      {a:[2,3]}

      document is dropped as soon as indexing is attempted, as a result

      {a:2}

      gets inserted.

      > c.drop()
      true
      > c.save( {a:3} );
      > c.save( {a:[2,3]} );
      > c.save( {a:2} );
      > c.ensureIndex( {a:1}, {unique:true,dropDups:true,background:true} )
      > c.find()
      { "_id" : ObjectId("4f277e782e17f5bc7039cd24"), "a" : 3 }
      { "_id" : ObjectId("4f277e7d2e17f5bc7039cd26"), "a" : 2 }

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: