title: How create a new array field with the aggregate framework
body: <p>I'm starting to use mongoDb and I'm stuck with a simple use case.</p>
  
  <p>Let's say I've got a collection 'aCollection' with entries such as this:</p>
  
  
  
  <pre class="lang-js prettyprint-override"><code>{ 
      _id: ObjectId(123),
      lat: 48,56623,
      long: 2,56332
  }
  </code></pre>
  
  <p>and I want to create a new collection with entries like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>{ 
      _id: ObjectId(123),
      lat: 48,56623,
      long: 2,56332,
      geometry : { 
          type: "Point",
          coordinates: [48,56623, 2,56332]
      }
  }
  </code></pre>
  
  <p>I thought about the aggregation framework:</p>
  
  <pre class="lang-js prettyprint-override"><code>db.aCollection.aggregate([{$project: { 
      _id: 1,
      lat: 1,
      long: 1,
      geometry: { 
          type: {$concat: ["Point"]},
          coordinates: ["$lat", "$long"]
      }
  }}])
  </code></pre>
  
  <p>But it ain't working and I get this exception:</p>
  
  <p>"exception: disallowed field type Array in object expression (at 'coordinates')"</p>
  
  <p>The following aggregation is working but it doesn't produce the expected result:</p>
  
  <pre class="lang-js prettyprint-override"><code>db.aCollection.aggregate([{$project: { 
      _id: 1,
      lat: 1,
      long: 1,
      geometry: { 
          type: {$concat: ["Point"]},
          coordinates: "$lat"
      }
  }}])
  </code></pre>
  
  <p>How would you proceed to create this collection 
  1) with the aggregation framework
  2) without the aggregation framework</p>
  
  <p>Thank you</p>