![](/img/trans.png)
[英]Wrong distance in geonear method with Doctrine MongoDB ODM
[英]Doctrine ODM @Distance in yaml
如何在Yaml映射文件中添加@Distance? 我试过了,没有用。
CP\AppBundle\Document\Point:
type: embeddedDocument
embedOne:
address:
targetDocument: CP\AppBundle\Document\Address
coordinates:
targetDocument: CP\AppBundle\Document\Coordinates
distance: distance
indexes:
coordinates:
keys:
coordinates: 2d
非常感谢!
距离字段需要指定为带有距离参数的浮点数:
CP\AppBundle\Document\Point:
type: embeddedDocument
embedOne:
address:
targetDocument: CP\AppBundle\Document\Address
coordinates:
targetDocument: CP\AppBundle\Document\Coordinates
fields:
distance:
type: float
distance: true
indexes:
coordinates:
keys:
coordinates: 2d
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.