SlideShare a Scribd company logo
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
●
    Validations
●
    Callbacks
●
    Index
●
    Scopes
●
    Paranoid
●
    Versioning (not so good)
●
    Timestamps
Migrations




http://github.com/adacosta/mongoid_rails_migrations
At first it seems to be a sh*#
          But it works!
Questions?

 @malev

More Related Content

Viewers also liked (6)

PDF
Lead Generation & CPA Marketing in the Hosting Industry - Curtis R. Curts
Sharksfly Marketing Inc.
 
PDF
Reproducibility of your development environment
Marcos Vanetta
 
PPTX
Can Your Web Hosting Survive The Digg Effect?
Sharksfly Marketing Inc.
 
PDF
2016 Lavorare Felici NEW
Gianluca De Nardi
 
DOC
Guía capas de la tierra
Cristian Díaz Hernández
 
ODP
Mongodb With Mongoid
Marcos Vanetta
 
Lead Generation & CPA Marketing in the Hosting Industry - Curtis R. Curts
Sharksfly Marketing Inc.
 
Reproducibility of your development environment
Marcos Vanetta
 
Can Your Web Hosting Survive The Digg Effect?
Sharksfly Marketing Inc.
 
2016 Lavorare Felici NEW
Gianluca De Nardi
 
Guía capas de la tierra
Cristian Díaz Hernández
 
Mongodb With Mongoid
Marcos Vanetta
 

Similar to Mongodb mongoid (20)

PPTX
Simple MongoDB design for Rails apps
Sérgio Santos
 
KEY
MongoMapper lightning talk
Kerry Buckley
 
PPTX
Webinar: Building Your First App
MongoDB
 
PDF
Using Mongoid with Ruby on Rails
Nicholas Altobelli
 
PPT
A Brief MongoDB Intro
Scott Hernandez
 
PDF
ActiveRecord vs Mongoid
Ivan Nemytchenko
 
KEY
Elastic tire demo
Scott Hamilton
 
PDF
Mongo and Harmony
Steve Smith
 
PDF
NLP Project Full Circle
Vsevolod Dyomkin
 
PPTX
Mongoose and MongoDB 101
Will Button
 
KEY
The Ruby/mongoDB ecosystem
Harold Giménez
 
PDF
Tame Accidental Complexity with Ruby and MongoMapper
Giordano Scalzo
 
PPTX
Evolving your Data Access with MongoDB Stitch - Drew Di Palma
MongoDB
 
PDF
Evolving your Data Access with MongoDB Stitch
MongoDB
 
KEY
MongoDB & Mongoid with Rails
Justin Smestad
 
PPSX
Programming in C [Module One]
Abhishek Sinha
 
PDF
Building Services With gRPC, Docker and Go
Martin Kess
 
PDF
search engines designed to support research on using statistical language models
CorporationMh
 
PDF
Building API Powered Chatbot & Application using AI SDK (1).pdf
diliphembram121
 
PDF
Building API Powered Chatbot & Application using AI SDK.pdf
diliphembram121
 
Simple MongoDB design for Rails apps
Sérgio Santos
 
MongoMapper lightning talk
Kerry Buckley
 
Webinar: Building Your First App
MongoDB
 
Using Mongoid with Ruby on Rails
Nicholas Altobelli
 
A Brief MongoDB Intro
Scott Hernandez
 
ActiveRecord vs Mongoid
Ivan Nemytchenko
 
Elastic tire demo
Scott Hamilton
 
Mongo and Harmony
Steve Smith
 
NLP Project Full Circle
Vsevolod Dyomkin
 
Mongoose and MongoDB 101
Will Button
 
The Ruby/mongoDB ecosystem
Harold Giménez
 
Tame Accidental Complexity with Ruby and MongoMapper
Giordano Scalzo
 
Evolving your Data Access with MongoDB Stitch - Drew Di Palma
MongoDB
 
Evolving your Data Access with MongoDB Stitch
MongoDB
 
MongoDB & Mongoid with Rails
Justin Smestad
 
Programming in C [Module One]
Abhishek Sinha
 
Building Services With gRPC, Docker and Go
Martin Kess
 
search engines designed to support research on using statistical language models
CorporationMh
 
Building API Powered Chatbot & Application using AI SDK (1).pdf
diliphembram121
 
Building API Powered Chatbot & Application using AI SDK.pdf
diliphembram121
 
Ad

Recently uploaded (20)

PDF
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PPTX
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Per Axbom: The spectacular lies of maps
Nexer Digital
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Per Axbom: The spectacular lies of maps
Nexer Digital
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Ad

Mongodb 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. Also has ● Validations ● Callbacks ● Index ● Scopes ● Paranoid ● Versioning (not so good) ● Timestamps
  • 12. At first it seems to be a sh*# But it works!