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

« back to all changes in this revision

Viewing changes to jstests/index5.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
// index5.js - test reverse direction index
 
2
 
 
3
function validate() {
 
4
    assert.eq( 2, t.find().count() );
 
5
    f = t.find().sort( { a: 1 } );
 
6
    assert.eq( 2, t.count() );
 
7
    assert.eq( 1, f[ 0 ].a );
 
8
    assert.eq( 2, f[ 1 ].a );
 
9
    r = t.find().sort( { a: -1 } );
 
10
    assert.eq( 2, r.count() );
 
11
    assert.eq( 2, r[ 0 ].a );
 
12
    assert.eq( 1, r[ 1 ].a );
 
13
}
 
14
 
 
15
t = db.index5;
 
16
t.drop();
 
17
 
 
18
t.save( { a: 1 } );
 
19
t.save( { a: 2 } );
 
20
 
 
21
validate();
 
22
 
 
23
t.ensureIndex( { a: -1 } );
 
24
validate();