MongoCollectionInfo::MongoCollectionInfo(mongo::BSONObj stats)
{
    _ns = MongoNamespace(QString::fromStdString(stats.getStringField("ns")));
    _sizeBytes = stats.getIntField("size");
    _count = stats.getIntField("count");
    _storageSizeBytes = stats.getIntField("storageSize");
}
    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");
    }
Exemple #3
0
void
Person::deserialize(const mongo::BSONObj& o)
{
  name = o.getStringField("name"); 
  age  = o.getIntField("age");
}