I have these WHERE conditions in a PostgreSQL query that I need to translate to mongoDB:
(starts_at BETWEEN :starts AND :ends) OR (starts_at <= :starts AND ends_at >= :starts)
Note :starts and :ends are UTC times. Specifically, I’m moving this from ActiveRecord to MongoMapper. So bonus if you can help me with that!
In mongodb, you’d use the $or operator like this (along with $gte and $lte):
In MongoMapper that would translate to: