C++ 在C+;中使用MongoDB地理空间索引时出错+;
在python中,pymongo为MongoDB地理空间索引提供了良好的支持。但是,对于C++,当我在C++中使用MangoCxx时,我对这个代码一直有一个错误:C++ 在C+;中使用MongoDB地理空间索引时出错+;,c++,mongodb,compiler-errors,geospatial,C++,Mongodb,Compiler Errors,Geospatial,在python中,pymongo为MongoDB地理空间索引提供了良好的支持。但是,对于C++,当我在C++中使用MangoCxx时,我对这个代码一直有一个错误: mongocxx::options::find opts; opts.limit(100); double lon=10.495; double lat=49.665; mongocxx::cursor cursor1= db["All_Points"].fin
mongocxx::options::find opts;
opts.limit(100);
double lon=10.495;
double lat=49.665;
mongocxx::cursor cursor1= db["All_Points"].find(document{} << "loc" << open_document
<< "$near" << bsoncxx::builder::stream::open_array
<< lon << lat << bsoncxx::builder::stream::close_array
<< close_document << finalize, opts);
for (auto&& doc : cursor1) {
std::cout << bsoncxx::to_json(doc) << std::endl;
}
mongocxx::options::find opts;
选择限值(100);
双lon=10.495;
双lat=49.665;
mongocxx::cursor cursor1=db[“All_Points”].find(document{}以及您显示的代码片段中声明的document
在哪里?我理解该文档是来自bsoncxx::builder::stream::document{}?如果我错了,请纠正我。请提供一个完整的、可编译的代码块和完整的错误消息。否则我们都只是猜测。我们应该能够将您的代码复制粘贴到文件中,并运行编译器,准确地再现您的错误。