Sharded-cluster deployment ========================== Using MognoDB 5.0 ----------------- mongos> db.createCollection("coll1") { "ok" : 1, "$clusterTime" : { "clusterTime" : Timestamp(1641988164, 4), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } }, "operationTime" : Timestamp(1641988164, 4) } mongos> db.createCollection("coll1") { "ok" : 1, "$clusterTime" : { "clusterTime" : Timestamp(1641988167, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } }, "operationTime" : Timestamp(1641988164, 4) } mongos> db.coll1.insert({ "name": "Antonio" }) WriteResult({ "nInserted" : 1 }) mongos> db.createCollection("coll1") { "ok" : 1, "$clusterTime" : { "clusterTime" : Timestamp(1641988213, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } }, "operationTime" : Timestamp(1641988205, 1) } mongos> db.coll1.createIndex({ "idx": 1 } ) { "raw" : { "__unknown_name__-rs0/ip-10-122-3-33:20000" : { "numIndexesBefore" : 1, "numIndexesAfter" : 2, "createdCollectionAutomatically" : false, "commitQuorum" : "votingMembers", "ok" : 1 } }, "ok" : 1, "$clusterTime" : { "clusterTime" : Timestamp(1641988250, 5), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } }, "operationTime" : Timestamp(1641988250, 5) } mongos> db.coll1.createIndex({ "idx": 1 } ) { "raw" : { "__unknown_name__-rs0/ip-10-122-3-33:20000" : { "numIndexesBefore" : 2, "numIndexesAfter" : 2, "note" : "all indexes already exist", "ok" : 1 } }, "ok" : 1, "$clusterTime" : { "clusterTime" : Timestamp(1641988250, 5), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } }, "operationTime" : Timestamp(1641988250, 5) } Summary: * Creating a collection of which an empty collection already exists: { "ok" : 1, ... } // INCONSISTENCY; Reverting we would have the same behaviour as mongod * Creating a collection of which a non empty collection exists: { "ok" : 1, ... } // INCONSISTENCY; Reverting we would have the same behaviour as mongod * Creating an index that already exists: { "ok" : 1, "raw.ok" : 1, "raw.note" : "all indexes already exist", ... } Using MognoDB 3.6.23 -------------------- mongos> db.createCollection("coll1") { "ok" : 1, "operationTime" : Timestamp(1641988452, 7), "$clusterTime" : { "clusterTime" : Timestamp(1641988452, 7), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } } mongos> db.createCollection("coll1") { "ok" : 0, "errmsg" : "a collection 'db1.coll1' already exists", "code" : 48, "codeName" : "NamespaceExists", "operationTime" : Timestamp(1641988452, 7), "$clusterTime" : { "clusterTime" : Timestamp(1641988452, 7), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } } mongos> db.coll1.insert({ "name": "Antonio" }) WriteResult({ "nInserted" : 1 }) mongos> db.createCollection("coll1") { "ok" : 0, "errmsg" : "a collection 'db1.coll1' already exists", "code" : 48, "codeName" : "NamespaceExists", "operationTime" : Timestamp(1641988573, 1), "$clusterTime" : { "clusterTime" : Timestamp(1641988573, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } } mongos> db.coll1.createIndex({ "idx": 1 } ) { "raw" : { "ip-10-122-3-33:20001" : { "createdCollectionAutomatically" : false, "numIndexesBefore" : 1, "numIndexesAfter" : 2, "ok" : 1 } }, "ok" : 1, "operationTime" : Timestamp(1641988633, 1), "$clusterTime" : { "clusterTime" : Timestamp(1641988633, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } } mongos> db.coll1.createIndex({ "idx": 1 } ) { "raw" : { "ip-10-122-3-33:20001" : { "numIndexesBefore" : 2, "numIndexesAfter" : 2, "note" : "all indexes already exist", "ok" : 1 } }, "ok" : 1, "operationTime" : Timestamp(1641988633, 1), "$clusterTime" : { "clusterTime" : Timestamp(1641988633, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) } } } Summary: * Creating a collection of which an empty collection already exists: { "ok" : 0, "errmsg" : "a collection 'db1.coll1' already exists", ... } * Creating a collection of which a non empty collection exists: { "ok" : 0, "errmsg" : "a collection 'db1.coll1' already exists", ... } * Creating an index that already exists: { "ok" : 1, "raw.ok" : 1, "raw.note" : "all indexes already exist", ... }