doorkeeper-mongodb
provides Doorkeeper support to
MongoMapper and Mongoid
(2, 3, 4 and 5 for doorkeeper-mongodb 3.0
and 4, 5, 6 and 7 for version 4.0
and higher). To start using it, add
to your Gemfile:
gem 'doorkeeper', '~> 4.0'
gem 'doorkeeper-mongodb', '~> 4.0'
# or if you want to use cutting edge version:
# gem 'doorkeeper-mongodb', github: 'doorkeeper-gem/doorkeeper-mongodb'
Run doorkeeper’s installation generator:
rails generate doorkeeper:install
This will install the doorkeeper initializer into
config/initializers/doorkeeper.rb
.
Set the ORM configuration:
Doorkeeper.configure do
orm :mongoid6 # or :mongoid7, :mongoid4, :mongoid5, :mongo_mapper
end
NOTE: mongo_mapper
gem works properly with MongoDB <= 3.2, on older versions it throws
Database command 'insert' failed: Unknown option to insert command: w
exception. This problem
requires mongo_mapper
gem update.
Also if you want to use mongo_mapper
with Rails >= 5.0, then you need to add activemodel-serializers-xml
gem
to your Gemfile
(or gems.rb
):
gem 'activemodel-serializers-xml'
Make sure you create indexes for doorkeeper models. You can do this either by
running rake db:mongoid:create_indexes
or (if you're using Mongoid 2) by
adding autocreate_indexes: true
to your config/mongoid.yml
Generate the db/indexes.rb
file and create indexes for the doorkeeper models:
rails generate doorkeeper:mongo_mapper:indexes
rake db:index
To run tests, clone this repository and run rake
. It will copy and run
doorkeeper’s original test suite, after configuring the ORM according to the
variables defined in .travis.yml
file.
To run locally, you need to choose a gemfile, with a command similar to:
$ export BUNDLE_GEMFILE=$PWD/gemfiles/Gemfile.mongoid6.rb
Please refer to https://github.com/doorkeeper-gem/doorkeeper for instructions on doorkeeper’s project.