Skip to content
Mongoid and MongoMapper support for Doorkeeper.
Branch: master
Clone or download
Latest commit 146d105 Oct 12, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github [ci skip] Update README and add GitHub templates Feb 2, 2018
config/locales PKCE support. Oct 10, 2018
doorkeeper @ 04ef043 Update to latest Doorkeeper, fix mongomapper Oct 11, 2018
gemfiles PKCE support. Oct 10, 2018
lib Fixes for MongoMapper Oct 12, 2018
spec Add Mongoid7 and test against Rails 5.2RC Jan 31, 2018
.gitignore Add the field confidential and the required methods to support it pro… Oct 4, 2018
.gitmodules Update to Doorkeeper 5.0 Oct 5, 2018
.hound.yml Extend doorkeeper 3 with its extracted ORMs May 12, 2015
.rspec first commit Sep 6, 2014
.travis.yml Use Mongoid 7 stable Apr 19, 2018 [ci skip] Update changelog Oct 12, 2018 [ci skip] Update README and add GitHub templates Feb 2, 2018 Extend doorkeeper 3 with its extracted ORMs May 12, 2015
MIT-LICENSE first commit Sep 6, 2014 Make gem 4.4 compatible Oct 4, 2018
doorkeeper-mongodb.gemspec PKCE support. Oct 10, 2018

Doorkeeper MongoDB extension

Gem Version Build Status


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:

# For Doorkeeper < 4.4
gem 'doorkeeper', '~> 4.3'
gem 'doorkeeper-mongodb', '~> 4.1.0'

# For Doorkeeper >= 4.4 && < 5.0
gem 'doorkeeper', '~> 4.4'
gem 'doorkeeper-mongodb', '~> 4.2'

# For Doorkeeper >= 5.0
gem 'doorkeeper', '~> 5.0'
gem 'doorkeeper-mongodb', '~> 5.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


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 RAILS=5.1
$ export BUNDLE_GEMFILE=$PWD/gemfiles/Gemfile.mongoid6.rb

Please refer to for instructions on doorkeeper’s project.

You can’t perform that action at this time.