Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

calleo/mongoid_decimal

Repository files navigation

MongoidDecimal

Build Status

Allows you to store Ruby BigDecimal as Decimal128 in MongoDB using Mongoid.

Installation

Add this line to your application's Gemfile:

gem 'mongoid_decimal', git: 'https://github.com/calleo/mongoid_decimal'

And then execute:

$ bundle

Usage

Requires MongoDB version 3.4 or later. Don't forget to set feature compatibility version using the Mongo shell:

db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )

Read more about the implications here.

If you have existing BigDecimal fields that are stored as String in Mongo (Mongoid default behavior) you will need to perform a data migration of those fields to Decimal128 for this Gem to work properly.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/calleo/mongoid_decimal.

License

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

Releases

No releases published

Packages

No packages published

Languages