summaryrefslogtreecommitdiff
path: root/jstests/core/useindexonobjgtlt.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/useindexonobjgtlt.js')
-rwxr-xr-xjstests/core/useindexonobjgtlt.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/jstests/core/useindexonobjgtlt.js b/jstests/core/useindexonobjgtlt.js
new file mode 100755
index 00000000000..06e94a812f6
--- /dev/null
+++ b/jstests/core/useindexonobjgtlt.js
@@ -0,0 +1,15 @@
+t = db.factories
+t.drop()
+t.insert( { name: "xyz", metro: { city: "New York", state: "NY" } } )
+t.ensureIndex( { metro : 1 } )
+
+assert( db.factories.find().count() )
+
+assert( db.factories.find( { metro: { city: "New York", state: "NY" } } ).count() )
+
+assert( db.factories.find( { metro: { city: "New York", state: "NY" } } ).explain().cursor == "BtreeCursor metro_1" )
+
+assert( db.factories.find( { metro: { $gte : { city: "New York" } } } ).explain().cursor == "BtreeCursor metro_1" )
+
+assert( db.factories.find( { metro: { $gte : { city: "New York" } } } ).count() == 1 )
+