MongoDB from Mongoid Ing. Marcos Vanetta @malev http://blog.malev.com.ar Three Pillar Global
MongoDB from Mongoid MongoDB : (from "humongous") is a scalable, high-performance, open source, document-oriente...
The philosophy of Mongoid is to provide a familiar API to Ruby developers who have been using Active Record or Data Mapper
class User include Mongoid::Document field :name, :type => String field :email, :type => String #...
class User include Mongoid::Document field :name,  :type => String field :email, :type => String field :phone, :type => St...
class User include Mongoid::Document field :name,  :type => String field :email, :type => String field :phone, :type => St...
class User include Mongoid::Document field :name, :type => String field :email, :type => String field :auto_approved, :typ...
class User include Mongoid::Document field :name, :type => String field :email, :type => String field :auto_approved, :typ...
@user = User.first @user = User.find(params[:id]) @users = User.where(:phone => “123”) @users =  @users .any_of({name: /ab...
Also has <ul><li>Validations
Callbacks
Index
Scopes
Upcoming SlideShare
Loading in...5
×

Mongodb With Mongoid

1,489

Published on

LightTalk in RubyConf Ar

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

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

No notes for slide

Mongodb With Mongoid

  1. 1. MongoDB from Mongoid Ing. Marcos Vanetta @malev http://blog.malev.com.ar Three Pillar Global
  2. 2. MongoDB from Mongoid MongoDB : (from &quot;humongous&quot;) is a scalable, high-performance, open source, document-oriented database. Mongoid : Mongoid (pronounced mann-goyd) is an Object-Document-Mapper (ODM) for MongoDB written in Ruby.
  3. 3. The philosophy of Mongoid is to provide a familiar API to Ruby developers who have been using Active Record or Data Mapper
  4. 4. class User include Mongoid::Document field :name, :type => String field :email, :type => String #...
  5. 5. class User include Mongoid::Document field :name, :type => String field :email, :type => String field :phone, :type => String #...
  6. 6. class User include Mongoid::Document field :name, :type => String field :email, :type => String field :phone, :type => String field :tags, :type => Array field :info, :type => Hash #...
  7. 7. class User include Mongoid::Document field :name, :type => String field :email, :type => String field :auto_approved, :type => Boolean field :message, :type => String field :phone, :type => String embeds_many :devices
  8. 8. class User include Mongoid::Document field :name, :type => String field :email, :type => String field :auto_approved, :type => Boolean field :message, :type => String field :phone, :type => String embeds_many :devices has_many :cars
  9. 9. @user = User.first @user = User.find(params[:id]) @users = User.where(:phone => “123”) @users = @users .any_of({name: /abc*/i}) @user = User.where({&quot;devices.token&quot;=>”ff”}) @user.devices.where({token: params[:t]}) Person.where(:title.all => [&quot;Sir&quot;]) Person.where(:title.in => [&quot;Sir&quot;, &quot;Madam&quot;])
  10. 10. Also has <ul><li>Validations
  11. 11. Callbacks
  12. 12. Index
  13. 13. Scopes
  14. 14. Paranoid
  15. 15. Versioning (not so good)
  16. 16. Timestamps </li></ul>
  17. 17. Migrations http://github.com/adacosta/mongoid_rails_migrations
  18. 18. At first it seems to be a sh*# But it works!
  19. 19. Questions? @malev
  1. A particular slide catching your eye?

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

×