Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用时我得到了意想不到的结果$geoWithin,
$geoWithin
我有这个:
perim = 10 center = [35.964734, 5.03952]
如果我运行:
list(db.users.find({"adr.cor":{"$geoWithin":{"$center":[center, perim]}}}))
我得到一个包含更多坐标的结果,例如:[36.743954, 4.365041]这是更远的!(至少 400 公里)我做错了什么?
[36.743954, 4.365041]
使用 $center:[longitude,latitude], radius 时,半径以弧度为单位,因此您必须将 10 弧度转换为公里。