summaryrefslogtreecommitdiff
path: root/jstests/index_check8.js
blob: 1964ecbe7fcbd58d8674e43d80e58d6aea96bec2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

t = db.index_check8
t.drop();

t.insert( { a : 1 , b : 1 , c : 1 , d : 1 , e : 1 } )
t.ensureIndex( { a : 1 , b : 1 , c : 1 } )
t.ensureIndex({ a: 1, b: 1, d: 1, e: 1 })

// this block could be added to many tests in theory...
if ((new Date()) % 10 == 0) {
    var coll = t.toString().substring(db.toString().length + 1);
    print("compacting " + coll + " before continuing testing");
    // don't check return code - false for mongos
    print("ok: " + db.runCommand({ compact: coll, dev: true }));
}

x = t.find( { a : 1 , b : 1 , d : 1 } ).sort( { e : 1 } ).explain()
assert( ! x.scanAndOrder , "A : " + tojson( x ) )

x = t.find( { a : 1 , b : 1 , c : 1 , d : 1 } ).sort( { e : 1 } ).explain()
//assert( ! x.scanAndOrder , "B : " + tojson( x ) )