title: Update Specific fields in a document record using MONGODB
body: <p>I am new to mongodb.So in sql to update the specific fields the query is</p>
  <p>In sql::</p>
  <pre><code>update students set marks = 95, grade = 'A' where _id = '1234';
  </code></pre>
  <p>In mongo shell ::</p>
  <pre><code>db.students.update({_id:'1234'},{&quot;$set&quot;:{&quot;marks&quot;:95,&quot;grade&quot;:'A'}},{multi:false});
  </code></pre>
  <p>Using mongotemplate , how can we acheive this. I have tried using the following code for single field update and it is working.</p>
  <pre><code>String uniqueId = student.getSection() + &quot;#&quot; + student.getRollNo();
      Query query = new Query();
      query.addCriteria(Criteria.where(&quot;_id&quot;).is(uniqueId));
      Update update = Update.update(&quot;marks&quot;, student.getMarks());
      logger.info(&quot;[Updating the Student marks using the id=][&quot;+uniqueId+&quot;]&quot;);
      UpdateResult result =  mongoTemplate.updateFirst(query, update, Student.class);
  </code></pre>
  <p>But how we acheive to update grade also using mongo templete?<br/>
  <strong>Note</strong> :: I want to update specific fields in the document , not replacing the entire document</p>