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


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

本文整理汇总了C++中mongo::BSONObj::getStringField方法的典型用法代码示例。如果您正苦于以下问题:C++ BSONObj::getStringField方法的具体用法?C++ BSONObj::getStringField怎么用?C++ BSONObj::getStringField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mongo::BSONObj的用法示例。


在下文中一共展示了BSONObj::getStringField方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MongoNamespace

MongoCollectionInfo::MongoCollectionInfo(mongo::BSONObj stats)
{
    _ns = MongoNamespace(QString::fromStdString(stats.getStringField("ns")));
    _sizeBytes = stats.getIntField("size");
    _count = stats.getIntField("count");
    _storageSizeBytes = stats.getIntField("storageSize");
}
开发者ID:AlPatsino,项目名称:robomongo,代码行数:7,代码来源:MongoCollectionInfo.cpp

示例2:

    MongoCollectionInfo::MongoCollectionInfo(mongo::BSONObj stats) : _ns(stats.getStringField("ns"))
    {
        // if "size" and "storageSize" are of type Int32 or Int64, they
        // will be converted to double by "numberDouble()" function.
        _sizeBytes = BsonUtils::getField<mongo::NumberDouble>(stats,"size");
        _storageSizeBytes = BsonUtils::getField<mongo::NumberDouble>(stats,"storageSize");

        // NumberLong because of mongodb can have very big collections
        _count = BsonUtils::getField<mongo::NumberLong>(stats,"count");
    }
开发者ID:davidau,项目名称:robomongo,代码行数:10,代码来源:MongoCollectionInfo.cpp

示例3: Handle

void Processer::Handle(mongo::BSONObj& bson)
{
	//handle the bson
	//maybe grid-bosn;maybe cluster-bson
	std::string grid_id;

	if(bson.hasField("grid_ID") && bson.hasField("cluster_data"))
	{
		grid_id = bson.getStringField("grid_ID");
		std::vector<mongo::BSONElement> c_ele = bson["cluster_data"].Array();
		for(int i=0;i<c_ele.size();i++)
		{
			mongo::BSONObj obj = c_ele[i].Obj();
			DoCluster(grid_id,obj);
		}
	}
	else
	{
		grid_id = "";
		DoCluster(grid_id,bson);
	}
}
开发者ID:keyboard-man,项目名称:kelp,代码行数:22,代码来源:processer.cpp

示例4: DoCluster

void Processer::DoCluster(const std::string& grid,mongo::BSONObj& cluster)
{
	std::string cluster_id;

	if(cluster.hasField("cluster_ID") && cluster.hasField("host_data"))
	{
		cluster_id = cluster.getStringField("cluster_ID");
		std::vector<mongo::BSONElement> h_ele = cluster["host_data"].Array();
		for(int i=0;i<h_ele.size();i++)
		{
			mongo::BSONObj obj = h_ele[i].Obj();
			DoHost(grid,cluster_id,obj);
		}
	}
	else
	{
		std::stringstream oss;
		oss << "This data is illegal! Drop!!";
		LOG4CXX_WARN(log_,oss.str());
		std::cout << cluster << std::endl;
	}

}
开发者ID:keyboard-man,项目名称:kelp,代码行数:23,代码来源:processer.cpp

示例5:

    MongoCollectionInfo::MongoCollectionInfo(mongo::BSONObj stats):_ns(QString::fromStdString(stats.getStringField("ns")))
    {
        // if "size" and "storageSize" are of type Int32 or Int64, they
        // will be converted to double by "numberDouble()" function.
        _sizeBytes = stats.getField("size").numberDouble();
        _storageSizeBytes = stats.getField("storageSize").numberDouble();

        _count = stats.getIntField("count");
    }
开发者ID:strogo,项目名称:robomongo,代码行数:9,代码来源:MongoCollectionInfo.cpp

示例6:

void
Person::deserialize(const mongo::BSONObj& o)
{
  name = o.getStringField("name"); 
  age  = o.getIntField("age");
}
开发者ID:dreamsxin,项目名称:rainbrurpg,代码行数:6,代码来源:Person.cpp

示例7: id

 virtual std::string id() {
     return _obj.getStringField("sensor");
 }
开发者ID:rymurr,项目名称:yocto_meteo_reader,代码行数:3,代码来源:mongo_message.hpp


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