2

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.

caarlos0
  • 20,020
  • 27
  • 85
  • 160

1 Answers1

1

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

Luiz E.
  • 6,769
  • 10
  • 58
  • 98