diff --git a/scripting/engine.cpp b/scripting/engine.cpp index 515f1386e0c..73eb7959b4f 100644 --- a/scripting/engine.cpp +++ b/scripting/engine.cpp @@ -185,8 +185,9 @@ namespace mongo { _storedNames.insert( n.valuestr() ); } - - db->ensureIndex( coll, BSON( "_id" << 1 ) , true ); + + if ( dbMutex.getState() > 0 ) + db->ensureIndex( coll, BSON( "_id" << 1 ) , true ); // --- remove things from scope that were removed