2012-05-11 200 views
0

我知道如何使用Symfony2的存儲簡單Product對象在MongoDB的嵌入文檔/ 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" : "..." 
    } 
} 

任何想法或文檔鏈接?

+1

+1補償隨機downvote – Gigala

回答