Using mongodb and mongoid. How would one grab all articles. Only articles with comments created 20 minutes ago?
class Article include Mongoid::Document
articles = Article.where(:_id.in => Comment.where(:created_at => 20.minutes.ago).map(&:article_id))
you can also do this, which should be more efficient:
articles = Article.where(:"comments.created_at".gt => 20.minutes.ago)