Using mongodb for the ruby on rails app -


i new work ruby on rails mongodb, can setup application structure properly.can me start it. example or sample appreciable.

first have add gem 'mongoid', '~> 5.0.0.beta', github: 'mongoid/mongoid' in gem file.

after add your_app/config/mongoid.yml file

development:  clients:    default:      database: database_name      hosts:        - localhost:27017 

then add model, can add number of fields

class model  include mongoid::document   field :name, type: string end 

then can test using console.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -