MongoidSnappy
Allow string attributes in Mongoid to be compressed with Snappy
Installation
Add this line to your application's Gemfile:
gem 'mongoid_snappy'
And then execute:
$ bundle
Or install it yourself as:
$ gem install mongoid_snappy
Usage
MongoDB doesn't have built in support for data compression.
See https://jira.mongodb.org/browse/SERVER-164
So in meantime the solution is application level compression.
Define a field of type Mongoid::Snappy
class MyModel
field :long_text, type: Mongoid::Snappy
end
Strings are transparently compressed and decompressed:
m = MyModel.new
m.long_text = 'a very long string here'
m.long_text # -> 'a very long string here'
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request