0
我试图用geoNear和组聚合(其他选项也罚款)做出以下MongoDB的geoNear和组
- 收集与
loc (2dsphere indexed)
和user_id
领域文件 - 有许多是该文件的一个
user_id
有许多loc
前)
{"user_id":1, "loc": { "type": "Point", "coordinates": ... }}
{"user_id":1, "loc": { "type": "Point", "coordinates": ... }}
{"user_id":2, "loc": { "type": "Point", "coordinates": ... }}
- 我想使用geoNear与最后插入
loc
S的每个user_id
我认为它会与聚集组和geoNear的顺序工作,但该文档告诉geoNear必须比其他人先走。
我该怎么做?