title: Mongodb $slice operator with Mongotemplate
body: <p>My Document is as below : </p>
  
  <pre><code>{
      "_id" : ObjectId("53b246aae4b0ad1d6b6a5c02"),        
      "name" : "PATHOLOGY",     
      "status" : true,
      "history" : [ 
          {
              "updateBy" : "53bcc05a48d1665cd8692993",            
              "date" : ISODate("2014-12-20T10:19:07.246Z")
          }
      ]
  }
  </code></pre>
  
  <p>I want to maintain last 5 histories in <code>history</code> key :</p>
  
  <p>so i can write following query for that: </p>
  
  <pre><code>db.collection.update( 
      { "_id" : ObjectId("53b246aae4b0ad1d6b6a5c02") },
      { $push : { 
          history : 
              {
                $each : [ 
                       {
                          "updateBy" : "53bcc05a48d1665cd8692993",                      
                          "date" : new Date()
                       }
                  ] , 
                $slice : -5 
              }
          } 
      } 
  );
  </code></pre>
  
  <p>But i don't know how to write <code>update</code> query in <code>MongoTemplate</code> with <code>$slice</code>, <code>$each</code> and <code>$push</code>.</p>