Files
mongo/jstests/core/useindexonobjgtlt.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

12 lines
386 B
JavaScript

// @tags: [requires_fastcount]
t = db.factories;
t.drop();
t.insert({name: "xyz", metro: {city: "New York", state: "NY"}});
t.createIndex({metro: 1});
assert(db.factories.find().count());
assert.eq(1, db.factories.find({metro: {city: "New York", state: "NY"}}).hint({metro: 1}).count());
assert.eq(1, db.factories.find({metro: {$gte: {city: "New York"}}}).hint({metro: 1}).count());