Files
mongo/jstests/core/count4.js
Rishab Joshi 4329ffafa3 SERVER-50442 Remove ensureIndex shell function
This commit replaces all the usages of ensureIndex() with createIndex() in JS tests and JS shell""
2020-11-17 14:23:10 +00:00

20 lines
300 B
JavaScript

t = db.count4;
t.drop();
for (i = 0; i < 100; i++) {
t.save({x: i});
}
q = {
x: {$gt: 25, $lte: 75}
};
assert.eq(50, t.find(q).count(), "A");
assert.eq(50, t.find(q).itcount(), "B");
t.createIndex({x: 1});
assert.eq(50, t.find(q).count(), "C");
assert.eq(50, t.find(q).itcount(), "D");