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

Only surface a "request doesn't allow collection to be created implicitly" error if no shard has the collection

    • Fully Compatible
    • Sharding 2019-02-11, Sharding 2019-02-25, Sharding 2019-05-06, Sharding 2019-05-20

      Even though a collection exists on some shards and not on others, it's confusing to get "request doesn't allow collection to be created implicitly" error.

      mongos> db.bar.createIndex( { _id: 1, x: 1, c: 1}, { unique: true });
      {
      	"raw" : {
      		"shardA/Kays-MacBook-Pro-2.local:27018,Kays-MacBook-Pro-2.local:27019,Kays-MacBook-Pro-2.local:27020" : {
      			"createdCollectionAutomatically" : false,
      			"numIndexesBefore" : 4,
      			"numIndexesAfter" : 5,
      			"ok" : 1
      		},
      		"shardB/Kays-MacBook-Pro-2.local:27021,Kays-MacBook-Pro-2.local:27022,Kays-MacBook-Pro-2.local:27023" : {
      			"ok" : 0,
      			"errmsg" : "request doesn't allow collection to be created implicitly",
      			"code" : 227,
      			"codeName" : "CannotImplicitlyCreateCollection",
      			"ns" : "test.bar"
      		}
      	},
      	"ok" : 1,
      	"operationTime" : Timestamp(1543854685, 3),
      	"$clusterTime" : {
      		"clusterTime" : Timestamp(1543854685, 5),
      		"signature" : {
      			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
      			"keyId" : NumberLong(0)
      		}
      	}
      } 

            Assignee:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Reporter:
            alyson.cabral@mongodb.com Alyson Cabral (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: