SlideShare ist ein Scribd-Unternehmen logo
1 von 13
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-oriented database. Mongoid : Mongoid (pronounced mann-goyd) is an Object-Document-Mapper (ODM) for MongoDB written in Ruby.
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 => String   #...
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 #...
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
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
@user = User.first @user = User.find(params[:id]) @users = User.where(:phone => “123”) @users =  @users .any_of({name: /abc*/i}) @user = User.where({"devices.token"=>”ff”}) @user.devices.where({token: params[:t]}) Person.where(:title.all => ["Sir"]) Person.where(:title.in => ["Sir", "Madam"])
Also has ,[object Object]
Callbacks
Index
Scopes

Weitere ähnliche Inhalte

Andere mochten auch

Resemblance
ResemblanceResemblance
ResemblanceRenny
 
Mobile app development process
Mobile app development processMobile app development process
Mobile app development processReady4S
 
Глянцевые_межкомнатные_двери
Глянцевые_межкомнатные_двериГлянцевые_межкомнатные_двери
Глянцевые_межкомнатные_двериspecdveri
 
L 11(gdr)(et) ((ee)nptel)
L 11(gdr)(et) ((ee)nptel)L 11(gdr)(et) ((ee)nptel)
L 11(gdr)(et) ((ee)nptel)Pradeep Godara
 
A Decentralized Network for Publishing Linked Data — Nanopublications, Trusty...
A Decentralized Network for Publishing Linked Data — Nanopublications, Trusty...A Decentralized Network for Publishing Linked Data — Nanopublications, Trusty...
A Decentralized Network for Publishing Linked Data — Nanopublications, Trusty...Tobias Kuhn
 

Andere mochten auch (8)

Zaragoza turismo 226
Zaragoza turismo 226Zaragoza turismo 226
Zaragoza turismo 226
 
Resemblance
ResemblanceResemblance
Resemblance
 
Mobile app development process
Mobile app development processMobile app development process
Mobile app development process
 
AXIS Nova Carlos Gomes - CYRELA GOLDSZTEIN
AXIS Nova Carlos Gomes - CYRELA GOLDSZTEIN AXIS Nova Carlos Gomes - CYRELA GOLDSZTEIN
AXIS Nova Carlos Gomes - CYRELA GOLDSZTEIN
 
8.Real Poem1
8.Real Poem18.Real Poem1
8.Real Poem1
 
Глянцевые_межкомнатные_двери
Глянцевые_межкомнатные_двериГлянцевые_межкомнатные_двери
Глянцевые_межкомнатные_двери
 
L 11(gdr)(et) ((ee)nptel)
L 11(gdr)(et) ((ee)nptel)L 11(gdr)(et) ((ee)nptel)
L 11(gdr)(et) ((ee)nptel)
 
A Decentralized Network for Publishing Linked Data — Nanopublications, Trusty...
A Decentralized Network for Publishing Linked Data — Nanopublications, Trusty...A Decentralized Network for Publishing Linked Data — Nanopublications, Trusty...
A Decentralized Network for Publishing Linked Data — Nanopublications, Trusty...
 

Ähnlich wie Mongodb With Mongoid

Webinar: Building Your First App
Webinar: Building Your First AppWebinar: Building Your First App
Webinar: Building Your First AppMongoDB
 
Simple MongoDB design for Rails apps
Simple MongoDB design for Rails appsSimple MongoDB design for Rails apps
Simple MongoDB design for Rails appsSérgio Santos
 
MongoDB and Spring - Two leaves of a same tree
MongoDB and Spring - Two leaves of a same treeMongoDB and Spring - Two leaves of a same tree
MongoDB and Spring - Two leaves of a same treeMongoDB
 
Mongo db halloween party
Mongo db halloween partyMongo db halloween party
Mongo db halloween partyAndrea Balducci
 
Grzegorz Witek - MongoDB + RoR, Mongoid (PRUG 1.0)
Grzegorz Witek - MongoDB + RoR, Mongoid (PRUG 1.0)Grzegorz Witek - MongoDB + RoR, Mongoid (PRUG 1.0)
Grzegorz Witek - MongoDB + RoR, Mongoid (PRUG 1.0)ecommerce poland expo
 
Mdb dn 2017_18_query_hackathon
Mdb dn 2017_18_query_hackathonMdb dn 2017_18_query_hackathon
Mdb dn 2017_18_query_hackathonDaniel M. Farrell
 
Mdb dn 2016_07_elastic_search
Mdb dn 2016_07_elastic_searchMdb dn 2016_07_elastic_search
Mdb dn 2016_07_elastic_searchDaniel M. Farrell
 
MongoDB and Ruby on Rails
MongoDB and Ruby on RailsMongoDB and Ruby on Rails
MongoDB and Ruby on Railsrfischer20
 
From Zero to Mongo, Art.sy Experience w/ MongoDB
From Zero to Mongo, Art.sy Experience w/ MongoDBFrom Zero to Mongo, Art.sy Experience w/ MongoDB
From Zero to Mongo, Art.sy Experience w/ MongoDBDaniel Doubrovkine
 
MongoDB Introduction, Installation & Execution
MongoDB Introduction, Installation & ExecutionMongoDB Introduction, Installation & Execution
MongoDB Introduction, Installation & ExecutioniFour Technolab Pvt. Ltd.
 
BarCamp KL H20 Open Social Hackathon
BarCamp KL H20 Open Social HackathonBarCamp KL H20 Open Social Hackathon
BarCamp KL H20 Open Social Hackathonmarvin337
 
SURVEY ON MONGODB: AN OPEN-SOURCE DOCUMENT DATABASE
SURVEY ON MONGODB: AN OPEN-SOURCE DOCUMENT DATABASESURVEY ON MONGODB: AN OPEN-SOURCE DOCUMENT DATABASE
SURVEY ON MONGODB: AN OPEN-SOURCE DOCUMENT DATABASEIAEME Publication
 
Advantages of using MongoDB
Advantages of using MongoDBAdvantages of using MongoDB
Advantages of using MongoDBadityakumar2080
 

Ähnlich wie Mongodb With Mongoid (20)

Mongodb mongoid
Mongodb mongoidMongodb mongoid
Mongodb mongoid
 
Webinar: Building Your First App
Webinar: Building Your First AppWebinar: Building Your First App
Webinar: Building Your First App
 
A Brief MongoDB Intro
A Brief MongoDB IntroA Brief MongoDB Intro
A Brief MongoDB Intro
 
Simple MongoDB design for Rails apps
Simple MongoDB design for Rails appsSimple MongoDB design for Rails apps
Simple MongoDB design for Rails apps
 
MongoDB and Spring - Two leaves of a same tree
MongoDB and Spring - Two leaves of a same treeMongoDB and Spring - Two leaves of a same tree
MongoDB and Spring - Two leaves of a same tree
 
MongoDB + Spring
MongoDB + SpringMongoDB + Spring
MongoDB + Spring
 
Mongo db halloween party
Mongo db halloween partyMongo db halloween party
Mongo db halloween party
 
Grzegorz Witek - MongoDB + RoR, Mongoid (PRUG 1.0)
Grzegorz Witek - MongoDB + RoR, Mongoid (PRUG 1.0)Grzegorz Witek - MongoDB + RoR, Mongoid (PRUG 1.0)
Grzegorz Witek - MongoDB + RoR, Mongoid (PRUG 1.0)
 
Mdb dn 2017_18_query_hackathon
Mdb dn 2017_18_query_hackathonMdb dn 2017_18_query_hackathon
Mdb dn 2017_18_query_hackathon
 
ShriNew
ShriNewShriNew
ShriNew
 
Mdb dn 2016_07_elastic_search
Mdb dn 2016_07_elastic_searchMdb dn 2016_07_elastic_search
Mdb dn 2016_07_elastic_search
 
Python and MongoDB
Python and MongoDBPython and MongoDB
Python and MongoDB
 
MongoDB and Ruby on Rails
MongoDB and Ruby on RailsMongoDB and Ruby on Rails
MongoDB and Ruby on Rails
 
From Zero to Mongo, Art.sy Experience w/ MongoDB
From Zero to Mongo, Art.sy Experience w/ MongoDBFrom Zero to Mongo, Art.sy Experience w/ MongoDB
From Zero to Mongo, Art.sy Experience w/ MongoDB
 
Mongo learning series
Mongo learning series Mongo learning series
Mongo learning series
 
MongoDB Introduction, Installation & Execution
MongoDB Introduction, Installation & ExecutionMongoDB Introduction, Installation & Execution
MongoDB Introduction, Installation & Execution
 
BarCamp KL H20 Open Social Hackathon
BarCamp KL H20 Open Social HackathonBarCamp KL H20 Open Social Hackathon
BarCamp KL H20 Open Social Hackathon
 
SURVEY ON MONGODB: AN OPEN-SOURCE DOCUMENT DATABASE
SURVEY ON MONGODB: AN OPEN-SOURCE DOCUMENT DATABASESURVEY ON MONGODB: AN OPEN-SOURCE DOCUMENT DATABASE
SURVEY ON MONGODB: AN OPEN-SOURCE DOCUMENT DATABASE
 
Advantages of using MongoDB
Advantages of using MongoDBAdvantages of using MongoDB
Advantages of using MongoDB
 
Mongo db
Mongo dbMongo db
Mongo db
 

Kürzlich hochgeladen

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 

Kürzlich hochgeladen (20)

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 

Mongodb With Mongoid

  • 1. MongoDB from Mongoid Ing. Marcos Vanetta @malev http://blog.malev.com.ar Three Pillar Global
  • 2. MongoDB from Mongoid MongoDB : (from "humongous") 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. The philosophy of Mongoid is to provide a familiar API to Ruby developers who have been using Active Record or Data Mapper
  • 4. class User include Mongoid::Document field :name, :type => String field :email, :type => String #...
  • 5. class User include Mongoid::Document field :name, :type => String field :email, :type => String field :phone, :type => String #...
  • 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. 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. 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. @user = User.first @user = User.find(params[:id]) @users = User.where(:phone => “123”) @users = @users .any_of({name: /abc*/i}) @user = User.where({"devices.token"=>”ff”}) @user.devices.where({token: params[:t]}) Person.where(:title.all => ["Sir"]) Person.where(:title.in => ["Sir", "Madam"])
  • 10.
  • 12. Index
  • 18. At first it seems to be a sh*# But it works!