Your SlideShare is downloading. ×
Grzegorz Witek - MongoDB + RoR, Mongoid (PRUG 1.0)
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

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

1,470

Published on

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

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

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

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

×