summaryrefslogtreecommitdiff
path: root/jstests/core/geo_regex0.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/geo_regex0.js')
-rw-r--r--jstests/core/geo_regex0.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/jstests/core/geo_regex0.js b/jstests/core/geo_regex0.js
new file mode 100644
index 00000000000..79042b9074e
--- /dev/null
+++ b/jstests/core/geo_regex0.js
@@ -0,0 +1,18 @@
+// From SERVER-2247
+// Tests to make sure regex works with geo indices
+
+t = db.regex0
+t.drop()
+
+t.ensureIndex( { point : '2d', words : 1 } )
+t.insert( { point : [ 1, 1 ], words : [ 'foo', 'bar' ] } )
+
+regex = { words : /^f/ }
+geo = { point : { $near : [ 1, 1 ] } }
+both = { point : { $near : [ 1, 1 ] }, words : /^f/ }
+
+assert.eq(1, t.find( regex ).count() )
+assert.eq(1, t.find( geo ).count() )
+assert.eq(1, t.find( both ).count() )
+
+