title: How to remove older data and save new data in MongoDB?
body: <p>This is my collection looks like</p>
  
  <pre><code>[{
     '_id':'1',
     'name':'John',
     'message':'Hi'
  },
  {
     '_id':'2',
     'name':'John',
     'message':'Hey'
  },
  {
    '_id':'3',
    'name':'John',
    'message':'Hello'
  }]
  </code></pre>
  
  <p>When I save next data, which </p>
  
  <pre><code>'_id' will be '4', 'name':'John', 'message':'howdy'. 
  </code></pre>
  
  <p>I want to push <code>'_id':'4'</code> to collection and pop <code>'_id':'1'</code>; similarly, when I save <code>'_id':'5'</code> to same collection <code>'_id':'2'</code> will remove and so on.</p>
  
  <p>I want to delete older data and save new data of limit entry within a collection. </p>
  
  <p>So how do I write this in <code>MongoDB</code> schema? </p>