title: Doctrine/MongoDB: Use key-value pairs instead numeric array
body: <p>I'm using Doctrine ODM with MongoDB. I have a "product model" like this:</p>
  
  <pre><code>namespace Cms\Model;
  
  /** @Document(collection="products") */
  class Product
  {
      /** @Id */
      private $id;
  
      /** @String */
      private $title;
  
      /** @String */
      private $description;
  
      /** @Date */
      private $createdAt;
  
      /** @EmbedMany(targetDocument="Cms\Model\ProductParam") */
      private $params;
  
      /** @EmbedOne(targetDocument="Cms\Model\Coordinate") */
      private $coordinate;
  
      public function  __construct()
      {
          $this-&gt;details = new \Doctrine\Common\Collections\ArrayCollection();
          $this-&gt;params = new \Doctrine\Common\Collections\ArrayCollection();
      }
  }
  </code></pre>
  
  <p>My ProductParam model is like this:</p>
  
  <pre><code>namespace Cms\Model;
  
  /** @EmbeddedDocument */
  class ProductParam
  {
      /** @String */
      private $type;
  
      /** @String */
      private $value;
  }
  </code></pre>
  
  <p>When i insert documents with this schema, the result is this:</p>
  
  <pre><code>{
     "_id": ObjectId("4d17ac603ffcf6d01300002a"),
     "title": "Peugeot 206 2001-X-Reg, 1.4lx Air-con, 12 months mot, Credit Cards Accepted.",
     "description": "PEUGEOT 206 1.4LX IMMACULATE THROUGHOUT DRIVES ABSOLUTELY SUPERB",
     "params": {
       "0": {
         "type": "carBrand",
         "value": "PEUGEOT"
      },
       "1": {
         "type": "carModel",
         "value": "206 LX"
      }
  }
  </code></pre>
  
  <p>But what i need is like this:</p>
  
  <pre><code>{
     "_id": ObjectId("4d17ac603ffcf6d01300002a"),
     "title": "Peugeot 206 2001-X-Reg, 1.4lx Air-con, 12 months mot, Credit Cards Accepted.",
     "description": "PEUGEOT 206 1.4LX IMMACULATE THROUGHOUT DRIVES ABSOLUTELY SUPERB",
     "params": {
       carBrand: "PEUGEOT",
       carModel: "206 LX"
     }
  }
  </code></pre>
  
  <p>How can i do this? Thanks.</p>