aq1018/mongoid_taggable_with_context — Issue #17: Scoped aggregation?
Author: yeggeps
Created: 2012-02-21 19:07:26+00:00
State: open

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?