sql >> Base de Datos >  >> NoSQL >> MongoDB

Cómo usar MongoDB GeoSpatial Index en C++

Puede usar mongocxx::options::find::limit . Compruebe también mongocxx::collection::find . Lo siguiente debería funcionar:

mongocxx::options::find opts;
opts.limit(10);

mongocxx::cursor cursor = coll.find(document{} << "loc" << open_document 
    << "$near" << bsoncxx::builder::stream::open_array 
    << lon << lat << bsoncxx::builder::stream::close_array 
    << close_document << finalize, opts);