title: How can I implement addFields mongoDB query in Java
body: <p>I have found several example at StackOverFlow related to addFields in Aggregation.
  But no one implemented in Java.</p>
  
  <pre><code>db.getCollection('myDocument').aggregate([
      {$match : {"metaId.ref.uuid" : "d6112808-1ce1-4545-bd52-cf55bc4ed25e"}},
      {$lookup: {from: "simple", localField: "someId.ref.uuid", foreignField: "uuid", 
      as: "simple"}},
      {"$unwind": "$simple"},
      {"$addFields": { "metaId.ref.name" : "$simple.name" }}
  ])
  </code></pre>
  
  <p>I am not able to Implement In Java Correctly:-- Not getting proper procedure</p>
  
  <pre><code>   LookupOperation lookupOperation =LookupOperation.newLookup().from("simple").localField("execId.ref.uuid").foreignField("uuid").as("simple");
              Aggregation myDocAggr = newAggregation(match(Criteria.where("metaId.ref.uuid").is(someUUID)), group("uuid").max("version").as("version"),
                      lookupOperation,
                      Aggregates.unwind(""),
                  Aggregates.addFields(fields));
              Document document =new Document();
              AggregationResults&lt;String&gt; myDocAggrResults = mongoTemplate.aggregate(myDocAggr , myDocument, myDocument.class);
              List&lt;String&gt; mydocumentList = myDocAggrResults .getMappedResults();
  </code></pre>
  
  <p>Not able to use unwind and addFields, this is sample java code, but it is not ok.
  Please help me. Thanks in advance </p>