Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-1695

Drop duplicates in the tutorial

    XMLWordPrintableJSON

Details

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

    Description

      The example code in the quick start tutorial for indexing and dropping duplicates does not work.

      http://docs.mongodb.org/manual/tutorial/create-a-unique-index/

      Change:
      db.collection.ensureIndex(

      { a: 1 }

      ,

      { dropDups: true }

      )

      To:
      db.collection.ensureIndex(

      { a: 1 }

      ,

      { unique: true, dropDups: true }

      )

      The working code is already in the documentation:

      http://docs.mongodb.org/manual/core/indexes/#drop-duplicates

      It's confusing because it seems implied that the duplicates will actually be dropped but they will not if you simply copy+paste the example code.

      Attachments

        Activity

          People

            sam.kleinman Sam Kleinman (Inactive)
            blakegardner Blake Gardner
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              10 years, 31 weeks, 6 days ago