-
Type:
Task
-
Resolution: Duplicate
-
Priority:
Trivial - P5
-
Affects Version/s: None
-
Component/s: None
-
Not Needed
db.mycoll.createIndex({a:1}, {expireAfterSeconds:100});
db.runCommand({insert:"mycoll", documents:[{a: new Date()}]});
{
n: 1,
electionId: ObjectId("7fffffff0000000000000002"),
opTime: { ts: Timestamp({ t: 1697567560, i: 1 }), t: Long("2") },
ok: 1,
'$clusterTime': {
clusterTime: Timestamp({ t: 1697567560, i: 1 }),
signature: {
hash: Binary(Buffer.from("171844c93c4de1a44f50a4ff32d591bfb90f1428", "hex"), 0),
keyId: Long("7290770490346438661")
}
},
operationTime: Timestamp({ t: 1697567560, i: 1 })
}
// Wait a few minutes …
// mongosh’s find() command returns nothing:
db.mycoll.find({}, null, {readConcern:{level:"snapshot", atClusterTime: Timestamp({ t: 1697567560, i: 2 })}});
// … but the server’s `find` command returns the expired document:
db.runCommand({find: "mycoll", readConcern:{level:"snapshot", atClusterTime: Timestamp({ t: 1697567560, i: 1 })}});
{
cursor: {
firstBatch: [
{
_id: ObjectId("652ed34800e1939439b41b7d"),
a: ISODate("2023-10-17T18:32:40.160Z")
}
],
id: Long("0"),
ns: 'test.mycoll',
atClusterTime: Timestamp({ t: 1697567560, i: 1 })
},
ok: 1,
'$clusterTime': {
clusterTime: Timestamp({ t: 1697567800, i: 1 }),
signature: {
hash: Binary(Buffer.from("3bfdb41c158047adf591122381b46aa9e8c2e406", "hex"), 0),
keyId: Long("7290770490346438661")
}
},
operationTime: Timestamp({ t: 1697567800, i: 1 })
}
It appears that mongosh is quietly redacting the readConcern.atClusterTime from the request.
When this happens, mongosh should show a warning like:
WARN: Redacting unsupported option readConcern.atClusterTime
Otherwise it’s quite confusing.
- duplicates
-
MONGOSH-1666 Shell helpers should not silently accept invalid options
-
- Closed
-
- is related to
-
NODE-5510 Do not silently filter out $changeStream stage options when building a change stream cursor via the watch() API
-
- Closed
-