Files
mongo/jstests/core/index_check5.js
Randolph Tan 5595b94560 SERVER-12127 migrate js tests to jscore suite when not related to writes
Moved test jstest/[a-i].js -> jstests/core/ and made changes to comply with write command api
2014-02-28 16:26:33 -05:00

18 lines
625 B
JavaScript

t = db.index_check5
t.drop();
t.save( { "name" : "Player1" ,
"scores" : [{"level" : 1 , "score" : 100},
{"level" : 2 , "score" : 50}],
"total" : 150 } );
t.save( { "name" : "Player2" ,
"total" : 90 ,
"scores" : [ {"level" : 1 , "score" : 90},
{"level" : 2 , "score" : 0} ]
} );
assert.eq( 2 , t.find( { "scores.level": 2, "scores.score": {$gt:30} } ).itcount() , "A" );
t.ensureIndex( { "scores.level" : 1 , "scores.score" : 1 } );
assert.eq( 2 , t.find( { "scores.level": 2, "scores.score": {$gt:30} } ).itcount() , "B" );