diff options
author | Eliot Horowitz <eliot@10gen.com> | 2013-10-08 13:47:00 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2013-10-08 13:47:11 -0400 |
commit | 2b4444c09fdf46adfda8e34116a7a8cae12dd18a (patch) | |
tree | 2c502dcee8bd7c098fce53be39679b3de5114ee6 /src/mongo/db/ops/delete.cpp | |
parent | 6069172335a0750b2477e3e2c31232ef9e9769f4 (diff) | |
download | mongo-2b4444c09fdf46adfda8e34116a7a8cae12dd18a.tar.gz |
SERVER-6405: move dropNS into Database and make private
Diffstat (limited to 'src/mongo/db/ops/delete.cpp')
-rw-r--r-- | src/mongo/db/ops/delete.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/mongo/db/ops/delete.cpp b/src/mongo/db/ops/delete.cpp index 4a1088d5c9d..1ccdcdac221 100644 --- a/src/mongo/db/ops/delete.cpp +++ b/src/mongo/db/ops/delete.cpp @@ -44,24 +44,24 @@ #include "mongo/util/stacktrace.h" namespace mongo { - + /* ns: namespace, e.g. <database>.<collection> pattern: the "where" clause / criteria justOne: stop after 1 match god: allow access to system namespaces, and don't yield */ - long long deleteObjects(const char *ns, BSONObj pattern, bool justOne, bool logop, bool god) { + long long deleteObjects(const StringData& ns, BSONObj pattern, bool justOne, bool logop, bool god) { if( !god ) { - if ( strstr(ns, ".system.") ) { + if ( ns.find( ".system.") != string::npos ) { /* note a delete from system.indexes would corrupt the db if done here, as there are pointers into those objects in NamespaceDetails. */ - uassert(12050, "cannot delete from system namespace", legalClientSystemNS( ns , true ) ); + uassert(12050, "cannot delete from system namespace", legalClientSystemNS( ns, true ) ); } - if ( strchr( ns , '$' ) ) { + if ( ns.find( '$' ) != string::npos ) { log() << "cannot delete from collection with reserved $ in name: " << ns << endl; - uassert( 10100 , "cannot delete from collection with reserved $ in name", strchr(ns, '$') == 0 ); + uasserted( 10100, "cannot delete from collection with reserved $ in name" ); } } @@ -69,9 +69,11 @@ namespace mongo { NamespaceDetails *d = nsdetails( ns ); if ( ! d ) return 0; - uassert( 10101 , "can't remove from a capped collection" , ! d->isCapped() ); + uassert( 10101, "can't remove from a capped collection", ! d->isCapped() ); } + string nsForLoOp = ns.toString(); // XXX-ERH + long long nDeleted = 0; shared_ptr< Cursor > creal = getOptimizedCursor( ns, pattern ); @@ -142,7 +144,7 @@ namespace mongo { BSONObjBuilder b; b.append( e ); bool replJustOne = true; - logOp( "d", ns, b.done(), 0, &replJustOne ); + logOp( "d", nsForLoOp.c_str(), b.done(), 0, &replJustOne ); } else { problem() << "deleted object without id, not logging" << endl; |