Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 在C+;中使用MongoDB地理空间索引时出错+;_C++_Mongodb_Compiler Errors_Geospatial - Fatal编程技术网

C++ 在C+;中使用MongoDB地理空间索引时出错+;

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

在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"].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{}?如果我错了,请纠正我。请提供一个完整的、可编译的代码块和完整的错误消息。否则我们都只是猜测。我们应该能够将您的代码复制粘贴到文件中,并运行编译器,准确地再现您的错误。