mlaunch init --replicaset --node 3
mongosh --quiet "mongodb:
> db.foo.insert({a:1})
mongosh --quiet "mongodb:
> db.shutdownServer()
mongosh --quiet "mongodb:
# empty collection
replset [primary] test> db.runCommand( {createIndexes:"emptyCollection",indexes: [{key :{ c:1}, name: "foo_i", unique: true},{key :{ a:1}, name: "foo_d"}]})
{
numIndexesBefore: 1,
numIndexesAfter: 3,
createdCollectionAutomatically: true,
commitQuorum: 'votingMembers',
ok: 1,
'$clusterTime': {
clusterTime: Timestamp({ t: 1725466919, i: 3 }),
signature: {
hash: Binary.createFromBase64('AAAAAAAAAAAAAAAAAAAAAAAAAAA=', 0),
keyId: Long('0')
}
},
operationTime: Timestamp({ t: 1725466919, i: 3 })
}
# not empty collection, wait for the quorum
replset [primary] test> db.runCommand( {createIndexes:"foo",indexes: [{key :{ c:1}, name: "foo_i", unique: true},{key :{ a:1}, name: "foo_d"}]})