summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
Diffstat (limited to 'jstests')
-rw-r--r--jstests/core/geo_near_tailable.js25
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);
+})();