2009-04-07 20:24:16 +02:00
|
|
|
f = db.jstests_drop;
|
|
|
|
|
|
|
|
f.drop();
|
|
|
|
|
2009-05-14 05:29:58 +02:00
|
|
|
assert.eq( 0, db.system.indexes.find( {ns:"test.jstests_drop"} ).count() , "A" );
|
2009-04-21 21:42:22 +02:00
|
|
|
f.save( {} );
|
2009-05-14 05:29:58 +02:00
|
|
|
assert.eq( 1, db.system.indexes.find( {ns:"test.jstests_drop"} ).count() , "B" );
|
2009-04-21 21:42:22 +02:00
|
|
|
f.ensureIndex( {a:1} );
|
2009-05-14 05:29:58 +02:00
|
|
|
assert.eq( 2, db.system.indexes.find( {ns:"test.jstests_drop"} ).count() , "C" );
|
2009-04-07 20:24:16 +02:00
|
|
|
assert.commandWorked( db.runCommand( {drop:"jstests_drop"} ) );
|
2009-05-14 05:29:58 +02:00
|
|
|
assert.eq( 0, db.system.indexes.find( {ns:"test.jstests_drop"} ).count() , "D" );
|
2009-04-21 21:42:22 +02:00
|
|
|
|
2009-05-14 05:29:58 +02:00
|
|
|
f.resetIndexCache();
|
2009-04-21 21:42:22 +02:00
|
|
|
f.ensureIndex( {a:1} );
|
2009-05-14 05:29:58 +02:00
|
|
|
assert.eq( 2, db.system.indexes.find( {ns:"test.jstests_drop"} ).count() , "E" );
|
2010-04-23 23:35:05 +02:00
|
|
|
assert.commandWorked( db.runCommand( {deleteIndexes:"jstests_drop",index:"*"} ), "delete indexes A" );
|
2009-05-14 05:29:58 +02:00
|
|
|
assert.eq( 1, db.system.indexes.find( {ns:"test.jstests_drop"} ).count() , "G" );
|
2009-04-21 22:22:54 +02:00
|
|
|
|
|
|
|
// make sure we can still use it
|
|
|
|
f.save( {} );
|
2010-01-25 19:08:03 +01:00
|
|
|
assert.eq( 1, f.find().hint( "_id_" ).toArray().length , "H" );
|