It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center。
已关闭8年。
使用C++驱动程序将二进制数组添加到BSON的语法是什么?我确定它在文档中的某个位置,但是找不到它。
此处的文档:http://api.mongodb.org/cplusplus/current/classmongo_1_1_b_s_o_n_obj_builder.html#a6882df3d0e4ca68446684769bc9e4d18
已关闭8年。
使用C++驱动程序将二进制数组添加到BSON的语法是什么?我确定它在文档中的某个位置,但是找不到它。
最佳答案
从http://groups.google.com/group/mongodb-user/browse_thread/thread/b836032ad24dc00d
要在C++中创建存储二进制数据的BSONObj,可以执行以下操作:
BSONObjBuilder builder;
b.appendBinData ("fieldname", datasize, BinDataGeneral, data);
BSONObj obj = builder.obj();
此处的文档:http://api.mongodb.org/cplusplus/current/classmongo_1_1_b_s_o_n_obj_builder.html#a6882df3d0e4ca68446684769bc9e4d18
关于c++ - MongoDB:如何在C++中将二进制数组存储在BSON中? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7840824/
10-09 21:23