当前位置: 首页>>代码示例>>C++>>正文


C++ BSONObj::copy方法代码示例

本文整理汇总了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 ;
      }
开发者ID:horizon3d,项目名称:SequoiaDB,代码行数:25,代码来源:optAccessPlan.hpp

示例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();
    }
开发者ID:ambroff,项目名称:mongo,代码行数:28,代码来源:authz_manager_external_state_mock.cpp

示例3: insert

 Status AuthzManagerExternalStateMock::insert(
         const NamespaceString& collectionName,
         const BSONObj& document,
         const BSONObj&) {
     _documents[collectionName].push_back(document.copy());
     return Status::OK();
 }
开发者ID:bladepan,项目名称:mongo,代码行数:7,代码来源:authz_manager_external_state_mock.cpp

示例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();
    }
}
开发者ID:AlexOreshkevich,项目名称:mongo,代码行数:28,代码来源:fail_point.cpp

示例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;
        }
开发者ID:calexandre,项目名称:mongo,代码行数:34,代码来源:load.cpp

示例6: setInternalUserAuthParams

 void setInternalUserAuthParams(const BSONObj& authParamsIn) {
     if (!isInternalAuthSet()) {
         authParamsSet = true;
     }
     boost::mutex::scoped_lock lk(authParamMutex);
     authParams = authParamsIn.copy();
 }
开发者ID:ANTco,项目名称:mongo,代码行数:7,代码来源:security_key.cpp

示例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();
    }
}
开发者ID:MaheshOruganti,项目名称:mongo-cxx-driver-legacy-1.1.0,代码行数:33,代码来源:fail_point.cpp

示例8: getInternalUserAuthParamsWithFallback

    BSONObj getInternalUserAuthParamsWithFallback() {
        if (!authParamsSet) {
            return BSONObj();
        }

        boost::mutex::scoped_lock lk(authParamMutex);
        return authParams.copy();
    }
开发者ID:3rf,项目名称:mongo,代码行数:8,代码来源:internal_user_auth.cpp

示例9:

 _ixmIndexKeyGen::_ixmIndexKeyGen ( const BSONObj &keyDef,
                                    IXM_KEYGEN_TYPE genType )
 {
    _keyPattern = keyDef.copy () ;
    _type = IXM_EXTENT_TYPE_NONE ;
    _keyGenType = genType ;
    _init () ;
 }
开发者ID:2015520,项目名称:SequoiaDB,代码行数:8,代码来源:ixmIndexKey.cpp

示例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() + "]" ;
 }
开发者ID:BryanLance,项目名称:SequoiaDB,代码行数:12,代码来源:omagentJob.cpp

示例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());
 }
开发者ID:calexandre,项目名称:mongo,代码行数:10,代码来源:index.cpp

示例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();
 }
开发者ID:Eric-Lu,项目名称:mongo,代码行数:10,代码来源:restapi.cpp

示例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;
     }
 }
开发者ID:Cassie90,项目名称:mongo,代码行数:11,代码来源:security_key.cpp

示例14: GetBSONObjModel

BSONObj CETLHostProcessor::GetBSONObjModel(CETLModel* pETLModel)
{
	BSONObj boETLModel;

	CETLHostModel* pETLHostModel = dynamic_cast<CETLHostModel*>(pETLModel);
	if (NULL != pETLHostModel)
	{
		boETLModel = pETLHostModel->GetBSONModel();
	}
	return boETLModel.copy();
}
开发者ID:hieutrtr,项目名称:DataMeasurement,代码行数:11,代码来源:ETLHostProcessor.cpp

示例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() + "]" ;
   }
开发者ID:Andrew8305,项目名称:SequoiaDB,代码行数:15,代码来源:omagentJob.cpp


注:本文中的BSONObj::copy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。