Mongoid - select DateTime as Date

I have a mongoid model named Person

with a updated_at

DateTime field . I want to query from Person

and then group_by

dates (not datetimes) from updated_at

, so I want to select from Person

updated_at

as a date instead of DateTime.

Enabling ActiveRecord

I would do:

Person.select("*, DATE(updated_at) as updated_at_date").where(...)    

      

How can I achieve this in mangoid?

Thank.

+3


source to share





All Articles