Reputation: 20633
Supposing I have a model Post
, wich contains only the field desc
.
The user can use hashtags, like #rails
inside any posts...
How can I list and count the hashtags used, for example, in the last 10 days?
I'm do not know much about mongodb, but I see that I could use something called map_reduce.. have no idea why/how.
Thanks in advance.
Upvotes: 2
Views: 1276
Reputation: 7229
You are right...this can be solved using mad/reduce function...
try this or this gem if you dont want to think a lot lol
https://github.com/jcoene/mongoid-mapreduce
Upvotes: 1