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