~ubuntu-branches/ubuntu/trusty/mongodb/trusty-proposed

« back to all changes in this revision

Viewing changes to jstests/index_check5.js

  • Committer: Bazaar Package Importer
  • Author(s): Antonin Kral
  • Date: 2010-01-29 19:48:45 UTC
  • Revision ID: james.westby@ubuntu.com-20100129194845-8wbmkf626fwcavc9
Tags: upstream-1.3.1
ImportĀ upstreamĀ versionĀ 1.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
t = db.index_check5
 
3
t.drop();
 
4
 
 
5
t.save( { "name" : "Player1" , 
 
6
          "scores" : [{"level" : 1 , "score" : 100},
 
7
                      {"level" : 2 , "score" : 50}], 
 
8
          "total" : 150 } );
 
9
t.save( { "name" : "Player2" , 
 
10
          "total" : 90 , 
 
11
          "scores" : [ {"level" : 1 , "score" : 90},
 
12
                       {"level" : 2 , "score" : 0} ]
 
13
        }  );
 
14
 
 
15
assert.eq( 2 , t.find( { "scores.level": 2, "scores.score": {$gt:30} } ).itcount() , "A" );
 
16
t.ensureIndex( { "scores.level" : 1 , "scores.score" : 1 } );
 
17
assert.eq( 1 , t.find( { "scores.level": 2, "scores.score": {$gt:30} } ).itcount() , "B" );