Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

additional test for geoindex

  • Loading branch information...
commit 7fa627b35627e94c94aafe9b0275de665129acd2 1 parent 2cf0b20
Greg Studer authored
Showing with 12 additions and 1 deletion.
  1. +12 −1 jstests/geo_circle2a.js
View
13 jstests/geo_circle2a.js
@@ -1,4 +1,6 @@
// From SERVER-2381
+// Tests to make sure that nested multi-key indexing works for geo indexes and is not used for direct position
+// lookups
db.test.drop()
db.test.insert({ p : [1112,3473], t : [{ k : 'a', v : 'b' }, { k : 'c', v : 'd' }] })
@@ -18,8 +20,17 @@ db.test.ensureIndex({ point : "2d" , "tags.k" : 1, "tags.v" : 1 })
// Succeeds, since should now lookup multi-keys correctly
assert(2 == db.test.find({ point : { $within : { $box : [[0,0],[12,12]] } } }).count(), "C")
-// Succeeds, and should use geoindex
+// Succeeds, and should not use geoindex
assert(2 == db.test.find({ point : [1, 10] }).count(), "D")
assert(2 == db.test.find({ point : [1, 10], "tags.v" : "value" }).count(), "E")
assert(1 == db.test.find({ point : [1, 10], "tags.v" : 123 }).count(), "F")
+
+db.test.drop()
+db.test.insert({ point:[ 1, 10 ], tags : [ { k : { 'hello' : 'world'}, v : 'value' }, { k : 'key2', v : 123 } ] })
+db.test.insert({ point:[ 1, 10 ], tags : [ { k : 'key', v : 'value' } ] })
+
+db.test.ensureIndex({ point : "2d" , "tags.k" : 1, "tags.v" : 1 })
+
+// Succeeds, should be able to look up the complex element
+assert(1 == db.test.find({ point : { $within : { $box : [[0,0],[12,12]] } }, 'tags.k' : { 'hello' : 'world' } }).count(), "G")
Please sign in to comment.
Something went wrong with that request. Please try again.