diff options
Diffstat (limited to 'jstests/change_streams/oplog_rewrite/change_stream_match_pushdown_documentKey_rewrite.js')
-rw-r--r-- | jstests/change_streams/oplog_rewrite/change_stream_match_pushdown_documentKey_rewrite.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/jstests/change_streams/oplog_rewrite/change_stream_match_pushdown_documentKey_rewrite.js b/jstests/change_streams/oplog_rewrite/change_stream_match_pushdown_documentKey_rewrite.js index 4a293da3290..a9a7bfc3455 100644 --- a/jstests/change_streams/oplog_rewrite/change_stream_match_pushdown_documentKey_rewrite.js +++ b/jstests/change_streams/oplog_rewrite/change_stream_match_pushdown_documentKey_rewrite.js @@ -135,6 +135,12 @@ for (const op of ["insert", "update", "replace", "delete"]) { [[op, 3, 0], [op, 3, 1]], [1, 1] /* expectedOplogCursorReturnedDocs */); + // Test out an {$eq: null} predicate on 'documentKey._id'. + verifyOps(resumeAfterToken, + {$match: {operationType: op, "documentKey._id": {$eq: null}}}, + [], + [0, 0] /* expectedOplogCursorReturnedDocs */); + // Test out a negated predicate on 'documentKey.shard'. It's not possible to rewrite this // predicate and make it part of the oplog filter, so we expect the oplog cursor to return 2 // docs on each shard. @@ -150,6 +156,13 @@ for (const op of ["insert", "update", "replace", "delete"]) { [[op, 2, 0], [op, 3, 0], [op, 2, 1], [op, 3, 1]], [2, 2] /* expectedOplogCursorReturnedDocs */); + // Test out the '{$eq: null}' predicate on a field that doesn't exist in 'documentKey' but that + // does exist in some of the underlying documents. + verifyOps(resumeAfterToken, + {$match: {operationType: op, "documentKey.z": {$eq: null}}}, + [[op, 2, 0], [op, 3, 0], [op, 2, 1], [op, 3, 1]], + [2, 2] /* expectedOplogCursorReturnedDocs */); + // Test out an $expr predicate on the full 'documentKey' field. verifyOps( resumeAfterToken, |