c# - 如何在 MongoDB C# 中使用地理空间查询?
问题描述
如何使用 C# 运行地理查询
像这样简单的事情:
db.restaurants.find({ location:
{ $geoWithin:
{ $centerSphere: [ [ -73.93414657, 40.82302903 ], 5 / 3963.2 ] } } })
关于如何做到这一点的任何想法?
解决方案
我相处融洽,方法如下:
var filter = Builders<BsonDocument>.Filter.GeoWithinCenterSphere("location", -73.93414657, 40.82302903 ,5 / 3963.2);
var results = collection.Find(filter).toList();
谢谢
推荐阅读
- javascript - 如何模拟“粉笔”库的所有方法?
- javascript - 如何使用 Media Recorder API 将录制流存储到移动浏览器中?
- php - PHP 7.4 CI 3 短回显标签在加载 CI 视图时抛出异常
- java - 按 IN 子句中的值查询DSL order
- spring - 如何在 Spring Cloud API Gateway 中实现基本身份验证?
- python - 读取文本文件中的最后一个字符,然后在满足条件时将其删除
- laravel-7 - 无法创建 laravel_logger_activity_table
- database - 在 .net 核心列中,“x”不能自动转换为 integer[] 您可能需要指定“USING”x”::integer[]”
- amazon-web-services - 如何使用 OpenApi yaml 在 AWS APIGateway 中启用缓存?
- mysql - 在 MYSQL 中重命名列名时引发意外错误