I have a date saved as a string like this tdate:"2016-11-26 2:23:11"
in mongodb. I want to count all objects which have this date 2016-11-26
.
This is how I am trying to do using php
but have no luck.
date_authenticated has this format "Y-m-d H:i:s"
while I want to get all objects by day
which should have this format "Y-m-d"
function count_auth($tdate) {
$collection = 'mycollection';
return $this->db->{$collection}->count(array('date_authenticated' => $tdate));
}