First, add Mongoid to your Gemfile:
gem "mongoid", "~> 4.0.0"
and then run bundle install. Or just run:
$ gem install mongoid
After installation, run the generator to create the config file:
$ rails g mongoid:config
which will create the file (myapp)/config/mongoid...