本文整理汇总了C++中BSONObj::copy方法的典型用法代码示例。如果您正苦于以下问题:C++ BSONObj::copy方法的具体用法?C++ BSONObj::copy怎么用?C++ BSONObj::copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BSONObj
的用法示例。
在下文中一共展示了BSONObj::copy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ossMemset
_optAccessPlan ( _dmsStorageUnit *su, const CHAR *collectionName,
const BSONObj &query, const BSONObj &orderBy,
const BSONObj &hint )
:_useCount(0)
{
ossMemset( _idxName, 0, sizeof( _idxName ) ) ;
ossMemset ( _collectionName, 0, sizeof(_collectionName) ) ;
ossStrncpy ( _collectionName, collectionName,
sizeof(_collectionName) - 1 ) ;
_isInitialized = FALSE ;
_scanType = TBSCAN ;
_indexCBExtent = DMS_INVALID_EXTENT ;
_indexLID = DMS_INVALID_EXTENT ;
_su = su ;
_query = query.copy() ;
_orderBy = orderBy.copy() ;
_hint = hint.copy() ;
_hintFailed = FALSE ;
_predList = NULL ;
_hashValue = hash(query, orderBy, hint) ;
_apm = NULL ;
_sortRequired = FALSE ;
_isAutoPlan = FALSE ;
}
示例2: insert
Status AuthzManagerExternalStateMock::insert(
OperationContext* txn,
const NamespaceString& collectionName,
const BSONObj& document,
const BSONObj&) {
BSONObj toInsert;
if (document["_id"].eoo()) {
BSONObjBuilder docWithIdBuilder;
docWithIdBuilder.append("_id", OID::gen());
docWithIdBuilder.appendElements(document);
toInsert = docWithIdBuilder.obj();
}
else {
toInsert = document.copy();
}
_documents[collectionName].push_back(toInsert);
if (_authzManager) {
_authzManager->logOp(
txn,
"i",
collectionName.ns().c_str(),
toInsert,
NULL);
}
return Status::OK();
}
示例3: insert
Status AuthzManagerExternalStateMock::insert(
const NamespaceString& collectionName,
const BSONObj& document,
const BSONObj&) {
_documents[collectionName].push_back(document.copy());
return Status::OK();
}
示例4: setMode
void FailPoint::setMode(Mode mode, ValType val, const BSONObj& extra) {
/**
* Outline:
*
* 1. Deactivates fail point to enter write-only mode
* 2. Waits for all current readers of the fail point to finish
* 3. Sets the new mode.
*/
stdx::lock_guard<stdx::mutex> scoped(_modMutex);
// Step 1
disableFailPoint();
// Step 2
while (_fpInfo.load() != 0) {
sleepmillis(50);
}
_mode = mode;
_timesOrPeriod.store(val);
_data = extra.copy();
if (_mode != off) {
enableFailPoint();
}
}
示例5: run
virtual bool run(const string& db,
BSONObj& cmdObj,
int options,
string& errmsg,
BSONObjBuilder& result,
bool fromRepl)
{
uassert( 16892, "Must be in a multi-statement transaction to begin a load.",
cc().hasTxn());
uassert( 16882, "The ns field must be a string.",
cmdObj["ns"].type() == mongo::String );
uassert( 16883, "The indexes field must be an array of index objects.",
cmdObj["indexes"].type() == mongo::Array );
uassert( 16884, "The options field must be an object.",
!cmdObj["options"].ok() || cmdObj["options"].type() == mongo::Object );
LOG(0) << "Beginning bulk load, cmd: " << cmdObj << endl;
const string ns = db + "." + cmdObj["ns"].String();
const BSONObj &optionsObj = cmdObj["options"].Obj();
vector<BSONElement> indexElements = cmdObj["indexes"].Array();
vector<BSONObj> indexes;
for (vector<BSONElement>::const_iterator i = indexElements.begin(); i != indexElements.end(); i++) {
uassert( 16885, "Each index spec must be an object describing the index to be built",
i->type() == mongo::Object );
BSONObj obj = i->Obj();
indexes.push_back(obj.copy());
}
cc().beginClientLoad(ns, indexes, optionsObj);
result.append("status", "load began");
result.append("ok", true);
return true;
}
示例6: setInternalUserAuthParams
void setInternalUserAuthParams(const BSONObj& authParamsIn) {
if (!isInternalAuthSet()) {
authParamsSet = true;
}
boost::mutex::scoped_lock lk(authParamMutex);
authParams = authParamsIn.copy();
}
示例7: setMode
void FailPoint::setMode(Mode mode, ValType val, const BSONObj& extra) {
/**
* Outline:
*
* 1. Deactivates fail point to enter write-only mode
* 2. Waits for all current readers of the fail point to finish
* 3. Sets the new mode.
*/
boost::lock_guard<boost::mutex> scoped(_modMutex);
// Step 1
disableFailPoint();
// Step 2
while (_fpInfo.load() != 0) {
sleepmillis(50);
}
// Step 3
uassert(16442,
stream() << "mode not supported " << static_cast<int>(mode),
mode >= off && mode < numModes);
_mode = mode;
_timesOrPeriod.store(val);
_data = extra.copy();
if (_mode != off) {
enableFailPoint();
}
}
示例8: getInternalUserAuthParamsWithFallback
BSONObj getInternalUserAuthParamsWithFallback() {
if (!authParamsSet) {
return BSONObj();
}
boost::mutex::scoped_lock lk(authParamMutex);
return authParams.copy();
}
示例9:
_ixmIndexKeyGen::_ixmIndexKeyGen ( const BSONObj &keyDef,
IXM_KEYGEN_TYPE genType )
{
_keyPattern = keyDef.copy () ;
_type = IXM_EXTENT_TYPE_NONE ;
_keyGenType = genType ;
_init () ;
}
示例10:
/*
omagent job
*/
_omagentJob::_omagentJob ( _omaTask *pTask, const BSONObj &info, void *ptr )
{
_pTask = pTask ;
_info = info.copy() ;
_pointer = ptr ;
if ( _pTask )
_jobName = _jobName + "Omagent job for task[" +
_pTask->getTaskName() + "]" ;
}
示例11: Descriptor
IndexDetails::IndexDetails(const BSONObj &info) :
_info(info.copy()),
_keyPattern(info["key"].Obj().copy()),
_unique(info["unique"].trueValue()),
_sparse(info["sparse"].trueValue()),
_clustering(info["clustering"].trueValue()),
_descriptor(new Descriptor(_keyPattern, false, 0, _sparse, _clustering)) {
verify(!_info.isEmpty());
verify(!_keyPattern.isEmpty());
}
示例12: getAdminUser
BSONObj RestAdminAccess::getAdminUser( const string& username ) const {
openAdminDb();
Client::GodScope gs;
readlocktryassert rl("admin.system.users", 10000);
Client::Context cx( "admin.system.users" );
BSONObj user;
if ( Helpers::findOne( "admin.system.users" , BSON( "user" << username ) , user ) )
return user.copy();
return BSONObj();
}
示例13: setInternalUserAuthParams
bool setInternalUserAuthParams(BSONObj authParams) {
if (!isInternalAuthSet()) {
internalSecurity.authParams = authParams.copy();
authParamsSet = true;
return true;
}
else {
log() << "Internal auth params have already been set" << endl;
return false;
}
}
示例14: GetBSONObjModel
BSONObj CETLHostProcessor::GetBSONObjModel(CETLModel* pETLModel)
{
BSONObj boETLModel;
CETLHostModel* pETLHostModel = dynamic_cast<CETLHostModel*>(pETLModel);
if (NULL != pETLHostModel)
{
boETLModel = pETLHostModel->GetBSONModel();
}
return boETLModel.copy();
}
示例15:
/*
omagent job
*/
_omagentJob::_omagentJob ( omaTaskPtr taskPtr, const BSONObj &info, void *ptr )
{
_taskPtr = taskPtr ;
_info = info.copy() ;
_pointer = ptr ;
_omaTask *pTask = _taskPtr.get() ;
if ( pTask )
_jobName = _jobName + "Omagent job for task[" +
pTask->getTaskName() + "]" ;
}