title: Mongodb and Codeigniter Record between two dates
body: <p>I am working on to get records between two dates using CodeIgniter and MongoDB.Fetching record but not with correction.</p>
  
  <p>My query:</p>
  
  <pre><code>$startDate=date('d-m-Y',$startDate);
  $endDate=date('d-m-Y',$endDate);
  
  $this-&gt;mongo_db-&gt;select("*");
  if ($startDate != '') {
      $this-&gt;mongo_db-&gt;where_gte('created_date', $startDate);
  }
  if ($endDate != '') {
      $this-&gt;mongo_db-&gt;where_lte('created_date', $endDate);
  }
  $this-&gt;mongo_db-&gt;where('id', $id);
  $results = $this-&gt;mongo_db-&gt;get('tbl_test');
  </code></pre>
  
  <p>Records in db like:</p>
  
  <pre><code>{ 
      "_id" : ObjectId("xxxxxxxxx..."), 
      "userId" : "4", 
      "pId" : "365", 
      "subject" : "hello", 
      "description" : "testing", 
      "status" : "0", 
      "status_description" : "", 
      "created_date" : "25-08-2018"
  }
  </code></pre>
  
  <p>Trying to find the proper solution..</p>