summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Jesse Jiryu Davis <jesse@mongodb.com>2013-10-31 12:12:03 -0400
committerMatt Kangas <matt.kangas@mongodb.com>2013-10-31 14:26:46 -0400
commit7efb2853b2b50225c748aa38a8c48a4ee7d47805 (patch)
tree200e16e5e16017ab667747e956de38469956984d
parentb76d47accaefb558d2e0e9175d53e991e74630b2 (diff)
downloadmongo-7efb2853b2b50225c748aa38a8c48a4ee7d47805.tar.gz
SERVER-10636 Verify that GeoJSON points are prohibited with 2d index and $near
Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
-rw-r--r--jstests/geo_2d_with_geojson_point.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/jstests/geo_2d_with_geojson_point.js b/jstests/geo_2d_with_geojson_point.js
new file mode 100644
index 00000000000..b5afc8b77b8
--- /dev/null
+++ b/jstests/geo_2d_with_geojson_point.js
@@ -0,0 +1,20 @@
+/*
+ * Use of GeoJSON points should be prohibited with a 2d index, SERVER-10636.
+ */
+
+var t = db.geo_2d_with_geojson_point;
+t.drop();
+t.ensureIndex({loc: '2d'});
+
+var geoJSONPoint = {
+ type: 'Point',
+ coordinates: [0, 0]
+};
+
+print(assert.throws(
+ function() {
+ t.findOne({
+ loc: {$near: {$geometry: geoJSONPoint}}});
+ },
+ [],
+ 'querying 2d index with GeoJSON point.'));