Mongodb yaml中距离的ODM原则
如何在yaml映射文件中添加@Distance?我试过了,但没用Mongodb yaml中距离的ODM原则,mongodb,symfony,doctrine-orm,doctrine,doctrine-odm,Mongodb,Symfony,Doctrine Orm,Doctrine,Doctrine Odm,如何在yaml映射文件中添加@Distance?我试过了,但没用 CP\AppBundle\Document\Point: type: embeddedDocument embedOne: address: targetDocument: CP\AppBundle\Document\Address coordinates: targetDocument: CP\AppBundle\Document\Coordinates distance: d
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