Title | Link |
---|---|
Github | https://github.com/mongodb/mongoid |
Docs | https://docs.mongodb.com/mongoid/current/ |
Make sure you have ruby
installed. I am using rbenv
to maintain different versions of ruby
across projects.
% rbenv -v
rbenv 1.1.2
% ruby -v
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
% gem install rails -v '~> 6.0.0'
% rails -v
Rails 6.0.3.6
% rails new blog --skip-active-record --skip-bundle
% cd blog
Note: You may receive a warning like this:
Could not find gem 'puma (~> 4.1)' in any of the gem sources listed in your Gemfile. Run
bundle install
to install missing gems.
Disregard it as we will be taking care of gem installation in a moment.
Add following to the Gemfile:
gem 'mongoid', '~> 7.0.5'
Install gem depndencies.
% bundle install
Generate the default Mongoid configuration.
% bin/rails g mongoid:config
Install yarn.
% npm -v
6.14.4
% npm install --global yarn
Install webpacker.
% rails webpacker:install
Create an empty repository named blog on github.com.
% git init .
% git add .
% git commit -m 'Initial commit'
% git remote add origin [email protected]:jagdeepsingh/blog.git
% git branch -M main
% git push -u origin main
Make sure a MongoDB server is running locally.
Run application.
% rails s
Your application is now running on http://127.0.0.1:3000.