Skip to content

Commit

Permalink
new minor test from an example in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dwight committed Sep 13, 2011
1 parent b0add6c commit 7d67754
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions jstests/useindexonobjgtlt.js
Original file line number Diff line number Diff line change
@@ -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.