diff options
author | Drew Paroski <drew.paroski@mongodb.com> | 2020-04-28 18:36:49 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-05-19 13:59:42 +0000 |
commit | e9c31e791b2e056c016c048d7e21c59e0e2452ea (patch) | |
tree | 0c35e40ed4f5d21d06c9765518ec80cbba507093 /jstests | |
parent | 0873f81d970825745da7ac8421744380ad2b92ad (diff) | |
download | mongo-e9c31e791b2e056c016c048d7e21c59e0e2452ea.tar.gz |
SERVER-47773 Error consistently when tailable cursors and $near are used together
(cherry picked from commit c8ced6df8f620daaa2e539f192f2eef356c63e9c)
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/geo_near_tailable.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/jstests/core/geo_near_tailable.js b/jstests/core/geo_near_tailable.js new file mode 100644 index 00000000000..405e236707c --- /dev/null +++ b/jstests/core/geo_near_tailable.js @@ -0,0 +1,25 @@ +// @tags: [requires_capped] +// +// Tests that combine $geoNear and tailable cursors. +// +(function() { +"use strict"; + +let cmdRes; +const collName = 'geo_near_tailable'; +const cappedCollName = 'geo_near_tailable_capped'; + +// Avoid using the drop() shell helper here in order to avoid "implicit collection recreation" +// which can happen when this test runs in certain passthroughs. For details, see +// "jstests/libs/override_methods/implicitly_shard_accessed_collections.js". +db.runCommand({drop: collName}); +db.runCommand({drop: cappedCollName}); +assert.commandWorked(db.createCollection(collName)); +assert.commandWorked(db.createCollection(cappedCollName, {capped: true, size: 10000})); + +// Error when tailable option is used with NEAR. +cmdRes = db.runCommand({find: collName, filter: {a: {$geoNear: [1, 2]}}, tailable: true}); +assert.commandFailedWithCode(cmdRes, ErrorCodes.BadValue); +cmdRes = db.runCommand({find: cappedCollName, filter: {a: {$geoNear: [1, 2]}}, tailable: true}); +assert.commandFailedWithCode(cmdRes, ErrorCodes.BadValue); +})(); |