I am trying to achieve the equivalent of this in mongoid (mongoid.org ORM):
select * from parents
inner join children
on parents.id = children.parent_id
where children.created_at <= some_timestamp
Parent embeds a child, A child belongs to a parent
I have no issues up to this point: Parent.where(:child.exists => true), but I have no idea how I am supposed to do the equivalent of ‘child.created_at’.lt => some_timestamp (Illegal to use a method on strings.)
Thanks
Mongoid uses UTC Timestamps internally, to work with a date in a query you can do the following: