Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scoped aggregation? #17

Open
mattiassvedhem opened this issue Feb 21, 2012 · 0 comments
Open

Scoped aggregation? #17

mattiassvedhem opened this issue Feb 21, 2012 · 0 comments
Labels

Comments

@mattiassvedhem
Copy link

I've wanted to do something like this

class Post
  include Mongoid::Document
  include Mongoid::TaggableWithContext
  include Mongoid::TaggableWithContext::AggregationStrategy::RealTime
  field :state
  taggable
end

Then to be able to do:

Post.create(state: 'published', tags: 'coffeescript')
Post.create(state: 'published', tags: 'ruby')
Post.create(state: 'unpublished', tags: 'java')

Post.where(state: 'published').tags
=> ['ruby', 'coffeescript']

Any ideas on how to implement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant