summaryrefslogtreecommitdiff
path: root/jstests/core/index/geo/geo_withinquery.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/index/geo/geo_withinquery.js')
-rw-r--r--jstests/core/index/geo/geo_withinquery.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/jstests/core/index/geo/geo_withinquery.js b/jstests/core/index/geo/geo_withinquery.js
new file mode 100644
index 00000000000..13f20c1433f
--- /dev/null
+++ b/jstests/core/index/geo/geo_withinquery.js
@@ -0,0 +1,24 @@
+// @tags: [
+// requires_getmore,
+// ]
+
+// SERVER-7343: allow $within without a geo index.
+t = db.geo_withinquery;
+t.drop();
+
+num = 0;
+for (x = 0; x <= 20; x++) {
+ for (y = 0; y <= 20; y++) {
+ o = {_id: num++, loc: [x, y]};
+ t.save(o);
+ }
+}
+
+assert.eq(21 * 21 - 1,
+ t.find({
+ $and: [
+ {loc: {$ne: [0, 0]}},
+ {loc: {$within: {$box: [[0, 0], [100, 100]]}}},
+ ]
+ }).itcount(),
+ "UHOH!");