File: index_many2.js

package info (click to toggle)
mongodb 1%3A2.4.8-2~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 81,908 kB
  • sloc: cpp: 739,744; ansic: 152,098; sh: 13,810; python: 11,864; makefile: 1,011; perl: 922; pascal: 617; java: 452; lisp: 222; asm: 174
file content (31 lines) | stat: -rw-r--r-- 542 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

t = db.index_many2;
t.drop()

t.save( { x : 1 } )

assert.eq( 1 , t.getIndexKeys().length , "A1" )

function make( n ){
    var x = {}
    x["x"+n] = 1;
    return x;
}

for ( i=1; i<1000; i++ ){
    t.ensureIndex( make(i) );
}

assert.eq( 64 , t.getIndexKeys().length , "A2" )


num = t.getIndexKeys().length

t.dropIndex( make(num-1) )
assert.eq( num - 1 , t.getIndexKeys().length , "B0" )

t.ensureIndex( { z : 1 } )
assert.eq( num  , t.getIndexKeys().length , "B1" )

t.dropIndex( "*" );
assert.eq( 1  , t.getIndexKeys().length , "C1" )