No commit activity in last 3 years
No release in over 3 years
Compatibility helpers for Mongoid.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Runtime

 Project Readme

Mongoid::Compatibility

Gem Version Build Status Dependency Status Code Climate

Compatibility helpers for Mongoid versions 2, 3, 4, 5, 6 and 7.

Install

Add mongoid-compatibility to your Gemfile.

gem 'mongoid-compatibility'

You may explicitly need to require mongoid/compatibility.

Use

Mongoid::Compatibility::Version

Mongoid::Compatibility::Version.mongoid2?
  # => is this Mongoid 2.x?

Mongoid::Compatibility::Version.mongoid3?
  # => is this Mongoid 3.x?

Mongoid::Compatibility::Version.mongoid4?
  # => is this Mongoid 4.x?

Mongoid::Compatibility::Version.mongoid5?
  # => is this Mongoid 5.x?

Mongoid::Compatibility::Version.mongoid6?
  # => is this Mongoid 6.x?

Mongoid::Compatibility::Version.mongoid7?
  # => is this Mongoid 7.x?

Instead of checking for Mongoid 6 and 7, use newer and older helpers.

Mongoid::Compatibility::Version.mongoid6_or_newer?
  # => is this Mongoid 6.x or 7.x, including beta 7?

Mongoid::Compatibility::Version.mongoid5_or_older?
  # => is this Mongoid 2.x, 3.x, 4.x or 5.x?

Mongoid::Compatibility::ObjectId

Mongoid::Compatibility::ObjectId.legal?('4e4d66343b39b68407000001')
  # => is this a valid BSON ID?

Contribute

See CONTRIBUTING.

Copyright and License

Copyright Daniel Doubrovkine and Contributors, Artsy Inc., 2015-2017

MIT License