Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

medley-inc/doorkeeper-mongodb

 
 

Repository files navigation

Doorkeeper MongoDB extension

Gem Version Build Status

Installation

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

MongoMapper

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'

Indexes

Mongoid

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

MongoMapper

Generate the db/indexes.rb file and create indexes for the doorkeeper models:

rails generate doorkeeper:mongo_mapper:indexes
rake db:index

Tests

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.

About

Mongoid and MongoMapper support for Doorkeeper.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%