bool run(const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if ( cmdObj["nolock"].trueValue() ) { return dbEval(dbname, cmdObj, result, errmsg); } Lock::GlobalWrite lk; Client::Context ctx( dbname ); return dbEval(dbname, cmdObj, result, errmsg); }
bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { if ( cmdObj["nolock"].trueValue() ) { return dbEval(txn, dbname, cmdObj, result, errmsg); } Lock::GlobalWrite lk(txn->lockState()); // No WriteUnitOfWork necessary, as dbEval will create its own, see "nolock" case above Client::Context ctx(txn, dbname ); return dbEval(txn, dbname, cmdObj, result, errmsg); }
bool run(const string& dbname , BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) { AuthenticationInfo *ai = cc().getAuthenticationInfo(); uassert( 12598 , "$eval reads unauthorized", ai->isAuthorizedReads(dbname.c_str()) ); if ( cmdObj["nolock"].trueValue() ) { return dbEval(dbname, cmdObj, result, errmsg); } // write security will be enforced in DBDirectClient mongolock lk( ai->isAuthorized( dbname.c_str() ) ); Client::Context ctx( dbname ); return dbEval(dbname, cmdObj, result, errmsg); }
bool run(const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl) { AuthenticationInfo *ai = cc().getAuthenticationInfo(); uassert( 12598 , "$eval reads unauthorized", ai->isAuthorizedReads(dbname.c_str()) ); if ( cmdObj["nolock"].trueValue() ) { return dbEval(dbname, cmdObj, result, errmsg); } // write security will be enforced in DBDirectClient // TODO: should this be a db lock? scoped_ptr<Lock::ScopedLock> lk( ai->isAuthorized( dbname.c_str() ) ? static_cast<Lock::ScopedLock*>( new Lock::GlobalWrite() ) : static_cast<Lock::ScopedLock*>( new Lock::GlobalRead() ) ); Client::Context ctx( dbname ); return dbEval(dbname, cmdObj, result, errmsg); }
void dummy_function_to_force_dbeval_cpp_linking() { BSONObj cmd; BSONObjBuilder result; string errmsg; dbEval( "", cmd, result, errmsg); }
bool run(const char *ns, BSONObj& cmdObj, string& errmsg, BSONObjBuilder& result, bool fromRepl) { return dbEval(ns, cmdObj, result, errmsg); }