with Mongoid<br />MongoDB + RoR<br />
Agenda<br />NoSQL<br />What is MongoDB?<br />Comparison – MongoDB vs. RDBMS<br />What is Mongoid?<br />Live MongoDB + Rail...
My experience<br />Been working with Mongoid for a few months<br />MongoDB 1.6<br />Mongoid 2.0.0.beta.20<br />Not yet on ...
NoSQL movement<br />
So what exactly is MongoDB?<br />Document oriented Database<br />Supports indexes<br />Rich querying<br />Auto-sharding<br...
MongoDB vs. SQL<br />Document<br />Document<br />reference<br />Document<br />reference<br />
MongoDB vs. SQL<br />Document<br />Document<br />reference<br />Embedded document<br />Document<br />reference<br />Embedd...
MongoDB vs. SQL<br />Document<br />Document<br />reference<br />Embedded document<br />Document<br />reference<br />Embedd...
What is                     ?<br />Think of ActiveRecord for MongoDB<br />Mapping Ruby objects to MongoDB documents and em...
How to use                       ?<br />class Building <br />include Mongoid::Document<br />include Mongoid::Timestamps<br...
How to use                       ?<br />class Level <br />include Mongoid::Document<br />embedded_in :building, :inverse_o...
Building.first(:conditions => {:name.in => [“Dom”,”Stodoła”]})<br />Building.levels.where(:type => “poddasze”)<br />Buildi...
Callbacks:<br />after_save, before_save, before_validation, after_create, etc.<br />Inheritance:<br />class House < Buildi...
Pros and cons of<br />
Roflcopter.pl<br />Examples of<br />
Summary in a few months (when our app goes production)<br />Summary                       <br />
But…<br />Summary                       <br />
…don’t wait and try it yourself!<br />Summary                       <br />
http://mongodb.org<br />http://mongoid.org<br />Summary                       <br />
Kolejnespotkanie<br />28 kwietnia – 19:00<br />Prezentacje?<br />talks@prug.pl<br />http://prug.pl<br />
Upcoming SlideShare
Loading in...5
×

Grzegorz Witek - MongoDB + RoR, Mongoid (PRUG 1.0)

1,497

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,497
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
13
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Grzegorz Witek - MongoDB + RoR, Mongoid (PRUG 1.0)

  1. 1. with Mongoid<br />MongoDB + RoR<br />
  2. 2. Agenda<br />NoSQL<br />What is MongoDB?<br />Comparison – MongoDB vs. RDBMS<br />What is Mongoid?<br />Live MongoDB + Rails examples<br />Pros and cons<br />Summary<br />
  3. 3. My experience<br />Been working with Mongoid for a few months<br />MongoDB 1.6<br />Mongoid 2.0.0.beta.20<br />Not yet on production<br />
  4. 4. NoSQL movement<br />
  5. 5. So what exactly is MongoDB?<br />Document oriented Database<br />Supports indexes<br />Rich querying<br />Auto-sharding<br />GridFS<br />BSON format<br />
  6. 6. MongoDB vs. SQL<br />Document<br />Document<br />reference<br />Document<br />reference<br />
  7. 7. MongoDB vs. SQL<br />Document<br />Document<br />reference<br />Embedded document<br />Document<br />reference<br />Embedded document<br />
  8. 8. MongoDB vs. SQL<br />Document<br />Document<br />reference<br />Embedded document<br />Document<br />reference<br />Embedded document<br />
  9. 9. What is ?<br />Think of ActiveRecord for MongoDB<br />Mapping Ruby objects to MongoDB documents and embedded documents<br />Supports Rails3<br />Named scopes, rich criteria API<br />Also some problems…<br />
  10. 10. How to use ?<br />class Building <br />include Mongoid::Document<br />include Mongoid::Timestamps<br />embeds_many :floors<br />field :name<br />field :occupied, :type => Boolean, :default => false<br />field :area, :type => Integer<br />end<br />
  11. 11. How to use ?<br />class Level <br />include Mongoid::Document<br />embedded_in :building, :inverse_of => :levels<br />embeds_many :rooms<br />field :type<br />validate :type, :presence => true, :uniqueness => {:scope => :city}<br />end<br />
  12. 12. Building.first(:conditions => {:name.in => [“Dom”,”Stodoła”]})<br />Building.levels.where(:type => “poddasze”)<br />Building.find(:all, :conditions => {:area.gt => 100})<br />How to use ?<br />
  13. 13. Callbacks:<br />after_save, before_save, before_validation, after_create, etc.<br />Inheritance:<br />class House < Building<br />end<br />house = House.new; house._type # => “house”<br />Building.all# [house]<br />How to use ?<br />
  14. 14. Pros and cons of<br />
  15. 15. Roflcopter.pl<br />Examples of<br />
  16. 16. Summary in a few months (when our app goes production)<br />Summary <br />
  17. 17. But…<br />Summary <br />
  18. 18. …don’t wait and try it yourself!<br />Summary <br />
  19. 19. http://mongodb.org<br />http://mongoid.org<br />Summary <br />
  20. 20. Kolejnespotkanie<br />28 kwietnia – 19:00<br />Prezentacje?<br />talks@prug.pl<br />http://prug.pl<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×