Can geoNear in MongoDB return a subset of fields in a document?

前端 未结 1 1554
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-06 20:32

When using geoNear it returns all the fields/entire document for the objects it finds, is there any way to limit it to a subset of fields?

1条回答
  •  天涯浪人
    2021-01-06 21:14

    That is currently not supported. The only workaround is using $near and do the distance calculation (dist = sqrt(dx * dx + dy * dy)) yourself

    0 讨论(0)
提交回复
热议问题