MongoDB中的geoNear是否可以返回文档中的字段的子集? [英] Can geoNear in MongoDB return a subset of fields in a document?

查看:57
本文介绍了MongoDB中的geoNear是否可以返回文档中的字段的子集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用geoNear时,它将返回该字段的所有字段/整个文档 找到的对象,是否有任何方法将其限制为字段的子集?

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?

推荐答案

当前不支持.唯一的解决方法是使用$ near并自行计算距离(dist = sqrt(dx * dx + dy * dy))

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

这篇关于MongoDB中的geoNear是否可以返回文档中的字段的子集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆