0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00
mongodb/jstests/index_check1.js
2009-01-26 23:28:26 -05:00

27 lines
726 B
JavaScript

db = connect("ed_db_index_check1");
db.somecollection.drop();
assert(db.system.namespaces.find({name:/somecollection/}).length() == 0);
db.somecollection.save({a:1});
assert(db.system.namespaces.find({name:/somecollection/}).length() == 1);
db.somecollection.ensureIndex({a:1});
assert(db.system.namespaces.find({name:/somecollection/}).length() == 2);
db.somecollection.drop();
assert(db.system.namespaces.find({name:/somecollection/}).length() == 0);
db.somecollection.save({a:1});
assert(db.system.namespaces.find({name:/somecollection/}).length() == 1);
db.somecollection.ensureIndex({a:1});
assert(db.system.namespaces.find({name:/somecollection/}).length() == 2);
assert(db.somecollection.validate().valid);