No commit activity in last 3 years
No release in over 3 years
Generate frequency maps using mongodb aggregations
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 3.0
 Project Readme

mongoid_frequency

mongoid_frequency adds syntactic sugar for generating frequency maps using the mongodb aggregation framework.

Installation

Install directly from rubygems:

gem install mongoid_frequency

Or if you are using a Gemfile, place this in your Gemfile:

gem 'mongoid_frequency'

Demo

> Book.all.frequency :genre
=> {"Adventure" => 12,
"Sci-fi" => 8,
"Romance" => 4,
"Non-Fiction" => 7}

> Book.collection.freq :genre
=> {"Adventure" => 12,
"Sci-fi" => 8,
"Romance" => 4,
"Non-Fiction" => 7}

> Book.collection.freq :genre, :published.lt => 40.years.ago
=> {"Sci-fi" => 2,
"Romance" => 1}

> author.books.freq :genre
=> {"Romance" => 2,
"Non-Fiction" => 1}

Contributing

  1. Fork it
  2. Make your changes
  3. Write/update tests. Run with rake.
  4. Issue a Pull Request

License

MIT. Go nuts.