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

autoIndexId not required for replica sets, yet

    XMLWordPrintableJSON

Details

    Description

      Here's the page of the docs where I'm seeing things.

      The quote is by autoIndexId:

      IMPORTANT
      For replica sets, all collections must have autoIndexId set to true.

      I'd suggest changing this to something like "For replica sets, you should not set autoIndexId: false, because it will interfere with replication."

      The page as it exists now isn't true; we currently do allow it (I verified in a sharded cluster). There are a couple of JIRA issues open on this (here's one, here's another, hat tip to scotthernandez for pointing me to them).

      Steps to reproduce:
      1. Spin up a replica set
      2. Perform the following on the primary:

      db.createCollection("foo", { autoIndexId: false } )
      db.foo.insert( { _id : 0, a : 1 } ) 
      db.foo.insert( { _id : 0, a : 1 } ) 
      db.foo.insert( { _id : 0, a : 1 } )
      db.foo.update( { _id : 0 }, { $set : { b : 1 } }, { multi : true } )
      

      Check the oplog on the primary (all the writes are there), and then check on a secondary with db.foo.find(); I see only one document, though I don't know if that's a deterministic finding or if other factors will affect this.

      Attachments

        Activity

          People

            steve.renaker@mongodb.com Steve Renaker (Inactive)
            william.cross William Cross
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              7 years, 46 weeks, 5 days ago