symfony2/MongoDB中的嵌入式文档

symfony2/MongoDB中的嵌入式文档,mongodb,symfony,doctrine-orm,Mongodb,Symfony,Doctrine Orm,我知道如何使用symfony2在mongodb中存储一个简单的产品对象: 此YAML文件: Acme\StoreBundle\Document\Product: fields: id: id: true name: type: string price: type: float 将生成此集合: { "_id" : ObjectId("..."), "name"

我知道如何使用symfony2在mongodb中存储一个简单的
产品
对象:

此YAML文件:

Acme\StoreBundle\Document\Product:
    fields:
        id:
            id:  true
        name:
            type: string
        price:
            type: float
将生成此集合:

{ 
"_id" : ObjectId("..."), 
"name" : "...", 
"price" : "..." 
}
但是现在,我想知道如何写出生成这样一个结构的东西:

{ 
"_id" : ObjectId("..."), 
"name" : "...", 
"price" : 
   { 
     "before" : "...", 
     "after" : "..." 
   }
}

任何想法或文档链接?

您可以使用嵌入文档

Acme\StoreBundle\Document\Product: 领域: 身份证件: id:对 姓名: 类型:字符串 参考单: 价格: targetDocument:Acme\StoreBundle\Documents\price 瀑布:全部 Acme\StoreBundle\Documents\price: 领域: 之前: 类型:浮子 之后: 类型:浮子
您可以使用嵌入文档

Acme\StoreBundle\Document\Product: 领域: 身份证件: id:对 姓名: 类型:字符串 参考单: 价格: targetDocument:Acme\StoreBundle\Documents\price 瀑布:全部 Acme\StoreBundle\Documents\price: 领域: 之前: 类型:浮子 之后: 类型:浮子
+1补偿随机否决票+1补偿随机否决票 Acme\StoreBundle\Document\Product: fields: id: id: true name: type: string referenceOne: price: targetDocument: Acme\StoreBundle\Documents\price cascade: all Acme\StoreBundle\Documents\price: fields: before: type: float after: type: float