Trying to shard a collection succeeds even without a unique index

XMLWordPrintableJSON

    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      > use sharded
      > db.unique.drop()
      true
      > db.adminCommand( { shardcollection : "sharded.unique", key:{a:1}})

      { "collectionsharded" : "sharded.unique", "ok" : 1 }

      > db.system.indexes.find()
      { "name" : "id", "ns" : "sharded.foo", "key" :

      { "_id" : 1 }

      , "v" : 0 }
      { "v" : 1, "key" :

      { "_id" : 1 }

      , "ns" : "sharded.unique", "name" : "id" }
      { "v" : 1, "key" :

      { "a" : 1 }

      , "ns" : "sharded.unique", "name" : "a_1" }

      Sharding the collection succeeds and creates two non-unique indexes, one on _id and one on the shard key. It should fail, saying that a unique index is necessary.

              Assignee:
              Greg Studer (Inactive)
              Reporter:
              Spencer Brody (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: