Compatibility helpers for Mongoid versions 2, 3, 4, 5 and 6.
Add mongoid-compatibility
to your Gemfile.
gem 'mongoid-compatibility'
You may explicitly need to require mongoid/compatibility
.
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::ObjectId.legal?('4e4d66343b39b68407000001')
# => is this a valid BSON ID?
See CONTRIBUTING.
Copyright Daniel Doubrovkine and Contributors, Artsy Inc., 2015-2017