2009-01-27 05:28:26 +01:00
|
|
|
|
|
|
|
db.somecollection.drop();
|
|
|
|
|
2009-02-01 03:25:40 +01:00
|
|
|
assert(db.system.namespaces.find({name:/somecollection/}).length() == 0, 1);
|
2009-01-27 05:28:26 +01:00
|
|
|
|
|
|
|
db.somecollection.save({a:1});
|
|
|
|
|
2009-02-01 03:25:40 +01:00
|
|
|
assert(db.system.namespaces.find({name:/somecollection/}).length() == 1, 2);
|
2009-01-27 05:28:26 +01:00
|
|
|
|
|
|
|
db.somecollection.ensureIndex({a:1});
|
|
|
|
|
2009-02-03 00:18:22 +01:00
|
|
|
var z = db.system.namespaces.find({name:/somecollection/}).length();
|
|
|
|
assert( z >= 1 , 3 );
|
|
|
|
|
|
|
|
if( z == 1 )
|
|
|
|
print("warning: z==1, should only happen with alternate storage engines");
|
2009-01-27 05:28:26 +01:00
|
|
|
|
|
|
|
db.somecollection.drop();
|
|
|
|
|
2009-02-01 03:25:40 +01:00
|
|
|
assert(db.system.namespaces.find({name:/somecollection/}).length() == 0, 4);
|
2009-01-27 05:28:26 +01:00
|
|
|
|
|
|
|
db.somecollection.save({a:1});
|
|
|
|
|
2009-02-01 03:25:40 +01:00
|
|
|
assert(db.system.namespaces.find({name:/somecollection/}).length() == 1, 5);
|
2009-01-27 05:28:26 +01:00
|
|
|
|
|
|
|
db.somecollection.ensureIndex({a:1});
|
|
|
|
|
2009-02-03 00:18:22 +01:00
|
|
|
var x = db.system.namespaces.find({name:/somecollection/}).length();
|
|
|
|
assert( x == 2 || x == z, 6);
|
2009-01-27 05:28:26 +01:00
|
|
|
|
2009-02-01 03:25:40 +01:00
|
|
|
assert(db.somecollection.validate().valid, 7);
|