title: lookup in mongodb aggregation
body: <p>The following bson is <code>personaddress</code> collection:   </p>
  
  <pre><code>{ 
          "id" : "123456", 
          "name" : "foo", 
          "address" : [
              {
                  "local" : "yes", 
                  "location" : [
                     {
                          "place" : {
                              "_id":"VZG", 
  
                          }, 
                          "place_lat" : "18", 
                          "place_lan" : "83", 
  
                  },
                  {
                          "place" : {
                              "name" : "kerala", 
                              "district" : "palakkad", 
                              "pincode" : "5203689", 
  
                          }, 
                          "place_lat" : "18", 
                          "place_lan" : "83",      
                      }
                  ]
              }
          ]
      } 
  </code></pre>
  
  <p>I  have an another <code>places</code> collection:</p>
  
  <pre><code> {
       "_id":"VZG",
       "name" : "vizag", 
       "district" : "Visakhaptanam, 
       "pincode" : "568923",
   }
  </code></pre>
  
  <p>Using lookup in mongodb aggregation, I want to embed  <code>places</code>  collection in <code>personaddress</code> collection</p>
  
  <p>I tried using </p>
  
  <pre><code>Aggregation aggregation = newAggregation(lookup("places", "address.location.place._id", "_id", "myplaces"), unwind("myplaces"));
  
  AggregationResults&lt;OutputDocument&gt; aggResults = mongoTemplate.aggregate(aggregation, PersonAddressDocument.class, OutputDocument.class);
  </code></pre>
  
  <p>Can anyone help me?           </p>