首页 > 解决方案 > 使用 Geonear 保持空位置

问题描述

我在 PHP 中,我有一个可能有位置或没有位置的文档,我在上面使用 geonear。我想保留空值的位置。我能怎么做 ?

[
   '$geoNear' => [
       'near' => [
          'type' => 'Point',
          'coordinates' => [$logitude, $latitude],
       ],
       'query' => [
          'matchingUUID' => $uuid,
       ],
       'distanceField' => 'destination.calculatedDistance',
       'spherical' => true,
   ],
]

非常感谢

标签: mongodbgeonear

解决方案


推荐阅读