|
repro:
[direct: mongos] test> sh.shardCollection('test.foo', {x: 1})
|
{
|
collectionsharded: 'test.foo',
|
ok: 1,
|
'$clusterTime': {
|
clusterTime: Timestamp(
|
{ t: 1700234597, i: 41 }
|
),
|
signature: {
|
hash: Binary(Buffer.from("0000000000000000000000000000000000000000", "hex"), 0),
|
keyId: Long("0")
|
}
|
},
|
operationTime: Timestamp({ t: 1700234597, i: 41 })
|
}
|
[direct: mongos] test> db.createView('foo', 'bar', [])
|
MongoServerError: got stale shardVersion response from shard _unknown_name_-rs0 at host ip-10-122-2-11:20000 :: caused by :: stale config in runCommand :: caused by :: timestamp mismatch detected for test.foo
|
[direct: mongos] test> db.createView('foo', 'bar', [])
|
MongoServerError: got stale shardVersion response from shard _unknown_name_-rs0 at host ip-10-122-2-11:20000 :: caused by :: stale config in runCommand :: caused by :: timestamp mismatch detected for test.foo
|
_createView checks the shardVersion for the nss. In case the collection is sharded, we expect a shardVersion which is never present. The {create} command runs always against the primary shard and only carries the dbVersion. We should check that the namespace already exists before checking the version as already done for timeseries
|