mongodb - 使用 Geonear 保持空位置
问题描述
我在 PHP 中,我有一个可能有位置或没有位置的文档,我在上面使用 geonear。我想保留空值的位置。我能怎么做 ?
[
'$geoNear' => [
'near' => [
'type' => 'Point',
'coordinates' => [$logitude, $latitude],
],
'query' => [
'matchingUUID' => $uuid,
],
'distanceField' => 'destination.calculatedDistance',
'spherical' => true,
],
]
非常感谢
解决方案
推荐阅读
- c# - UnityWebRequest 查询!无法将变量从 Unity 传递给 PHP
- node.js - 如何将多个对象发送到 .ejs 文件
- ios - 如何找到仅高于 0 的用户输入的平均值
- ios - 我可以在我的 Windows 上使用 MacOS VM 将应用程序上传到 App Store 而不会遇到任何法律问题吗?
- python - Python 使用 unittest 运行 unittest n 次并使用 htmltestrunner 生成报告
- c++ - C++ 中 if-then-else 块的首选顺序
- python - 使用Python进行网页抓取时如何分隔列和格式化日期?
- list - Scala 函数需要 2 小时,有 200 万个值
- ruby-on-rails - 为什么我们通常不为 http GET 使用强参数
- scala - Scala为什么_(下划线)适用于第一个参数而不是第二个参数