7. Schema Design
• The data your application needs.
• How your application will read the data.
• How your application will write the data.
Traditional MongoDB
Your application doesn’t matter.
Only about the data.
Only relevant during design.
It’s always about your application.
Not only about the data, but also
how it’s used.
Relevant during the lifetime of your
application.
9. Create blog apps
$ rails new blog –-skip-active-record
$ cd blog
$ vi Gemfile
#add and save
gem 'mongoid', github: 'mongoid/mongoid‘
gem 'bson', github: 'mongodb/bson-ruby'
gem 'execjs‘
gem 'therubyracer‘
$ bundle
$ rake g mongoid:config
$ rails g scaffold post title:string body:text tags:array
... ① string to array
$ Rails g model comment author:string body:text
... ② def relationship, routes
$ rails g controller comments
... ③ def create
... ④ create list, form for comment