I need to write a query that finds all documents created on a specified date.
Let's suppose that the date is today.
I tried this:
Document.all(:created_at => Date.parse(Time.now.strftime('%Y/%m/%d')))
but I got:
Cannot serialize an object of class Date into BSON.
Thanks for your help.
UPDATE This link explains how to do so Date Range Queries With MongoMapper.
Document.count( :created_at => { '$gt' => 2.days.ago.midnight, '$lt' => 1.day.ago.midnight } )