From 64c7e4b4f8dd07ade2ef9f6c91e9d08fd94d7f8f Mon Sep 17 00:00:00 2001 From: "A. Jesse Jiryu Davis" Date: Thu, 31 Oct 2013 12:12:03 -0400 Subject: [PATCH] Verify that GeoJSON points are prohibited with 2d index and $near, SERVER-10636. --- jstests/geo_2d_with_geojson_point.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 jstests/geo_2d_with_geojson_point.js diff --git a/jstests/geo_2d_with_geojson_point.js b/jstests/geo_2d_with_geojson_point.js new file mode 100644 index 0000000000000..b5afc8b77b8a8 --- /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.'));