User* User::Clone() { mongo::BSONObj obj; ToBson(obj); User* pNew = new User(); pNew->FromBson(obj); return pNew; }
bsoncxx::document::value ToBsonDocument(Mave mave) { if (!mave.IsMap()) { throw exception("Mave::ToBsonDocument(): unexpected type encountered"); } bsoncxx::builder::core result{ false }; ToBson(mave, result); return result.extract_document(); }
bsoncxx::array::value ToBsonArray(Mave mave) { if (!mave.IsVector()) { throw exception("Mave::ToBsonArray(): unexpected type encountered"); } bsoncxx::builder::core result{ true }; ToBson(mave, result); return result.extract_array(); }
void User::ToBson(std::string& __buf) { mongo::BSONObj __obj; ToBson(__obj); __buf = std::string(__obj.objdata(),__obj.objsize()); }
void User::ToCompress(std::string & __buf) { mongo::BSONObj __obj; ToBson(__obj); CUtil::Compress(__obj.objdata(),__obj.objsize(),__buf); }