本文整理汇总了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");
}
示例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");
}
示例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);
}
}
示例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;
}
}
示例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");
}
示例6:
void
Person::deserialize(const mongo::BSONObj& o)
{
name = o.getStringField("name");
age = o.getIntField("age");
}
示例7: id
virtual std::string id() {
return _obj.getStringField("sensor");
}