Currently, Mongoid has a generator which generates `config/mongoid.yml` for new apps.
In addition, for Rails apps, we should generate `config/initializers/mongoid.rb`. This important after releasing MONGOID-5293 (config.load_defaults option), to ensure all newly generated apps are properly locking their Mongoid version.
The generated initializer should look like:
# config/initializers/mongoid.rb Mongoid.configure do # Load Mongoid behavior defaults. This automatically sets # features flags (refer to documentation) config.load_defaults[<%= Mongoid::VERSION %>] end # Enable Mongo driver query cache for Rack # Rails.application.config.middleware.use(Mongo::QueryCache::Middleware) # Enable Mongo driver query cache for ActiveJob # ActiveSupport.on_load(:active_job) do # include Mongo::QueryCache::Middleware::ActiveJob # end
I've included the latter two Query cache items because users should be aware of these. They should probably be commented out by default.
- related to
-
MONGOID-5492 Rails generator for MongoDB/Mongoid
- Closed