summaryrefslogtreecommitdiff
path: root/jstests/index_many2.js
blob: f113b8b87ed1ebb06519c5dc4930dc4ffaa19912 (plain)
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" )