No commit activity in last 3 years
No release in over 3 years
Mongoid models are saved in one collection by default. However, when collections after too large , it could be extracted into a separated one and query form that, to make it query faster
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.17
~> 10.0
~> 3.0

Runtime

~> 6.4.0
 Project Readme

MongoidCollectionSeparatable

Support mongoid collections to be saved into and queried from separated collections with condition

Installation

Add this line to your application's Gemfile:

gem 'mongoid_collection_separatable'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mongoid_collection_separatable

Usage

Add the following line into the model class that you want to split:

  separated_by :form_id, parent_class: 'Form', on_condition: :entries_separated

When on_condition field in parent_class is set to true, current records referenced to separated_by field will be saved into separated collections. Default collections name will be #{current_collection}_#{form_id_value}

Migration task to separate collections:

rake db:mongoid:collection:separate[origin_class,condition_key,condition_value]

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/mongoid_collection_separatable.

License

The gem is available as open source under the terms of the MIT License.