mongodb c++ API

来源:互联网 发布:dos复制文件到linux 编辑:程序博客网 时间:2024/05/18 20:31

1、获取objectID

   mongo::BSONElement e;
db.m_resultRow.getObjectID(e);
       
string ID = e.OID().toString();

2、查询嵌套bson串

mongo::Query qobj = mongo::Query(BSON("ptid" << BSON("$exists" << false)));

3、插入int类型数据

db.icinfo.update({},{$set:{"ptid":NumberInt()}},false, true);

0 0