如何在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
非常感谢!
答案 0 :(得分:-1)
需要将距离字段指定为具有距离参数的浮点数:
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