jeudi 5 avril 2018

Laravel 5.5 : Get mongodb documents between specific date range

Following is the structure of Mongo-DB document:

{
   _id : 'some id',
   message : 'some message',
   createdTime : ISODate('2018-03-08T08:01:46.000Z')
 }

I want to get documents in specific date range, my code is as following:

 $results = Messages::whereBetween(
                             'createdTime', array(
                                 "2018-4-1",
                                 "2018-4-4"
                             )
                         )->get();
        return $results;

but the code is not working, kindly guide me how can I achieve it.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire