Permalink
Browse files

new minor test from an example in docs

  • Loading branch information...
1 parent b0add6c commit 7d67754c9f4d38d14bfff9f2e9e094f32ea8b75f @dwight dwight committed Sep 10, 2011
Showing with 15 additions and 0 deletions.
  1. +15 −0 jstests/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 )
+

0 comments on commit 7d67754

Please sign in to comment.