SlideShare a Scribd company logo
1 of 15
codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 1
MongoDB & Ruby in 10 Minutes
Tobias.Trelle@codecentric.de @tobiastrelle
codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 2
Tobias Trelle
- Senior IT Consultant @
codecentric AG (Düsseldorf)
- Organizer of MongoDB
User Group Düsseldorf
- Authoring a MongoDB book
(dpunkt-Verlag)
codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 3
MongoDB
NoSQL data store / Open Source
Single records are called documents
Replication & Sharding out-of-the-box
Map/Reduce
Geospatial Indexes / Queries
codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 4
MongoDB Overview
Server
Database
Collection
Document
Field
Tabelle
Zeile
Spalte
Relationales
Pendant Aber …
Flexibles
Schema
- Arrays
- Rekursiv
codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 5
Documents
Ordered set of key/values pairs
Values can be an array, document or simple type
Max size = 16 MB
Logical namespaces for documents are called collections
Schemaless
Format: BSON = Binary JSON != JSON
codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 6
Documents
{}
{ hello: "MongoDB" }
{ foo:
{ bar: "baz"},
a: [1,2,3,5,8]
}
codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 7
MongoDB Gems
$ gem install mongo
Fetching: bson-1.9.0.gem (100%)
Fetching: mongo-1.9.0.gem (100%)
Successfully installed bson-1.9.0
Successfully installed mongo-1.9.0
2 gems installed
...
codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 8
MongoDB Gems
$ gem install bson_ext
Fetching: bson_ext-1.9.0.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a
while...
Successfully installed bson_ext-1.9.0
1 gem installed...
codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 9
Ruby Driver API
codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 10
Ruby Driver
irb(main):001:0> require 'mongo'
=> true
irb(main):002:0> include Mongo
=> Object
irb(main):003:0> client = MongoClient.new
...
irb(main):004:0> db = client["test"]
...
irb(main):005:0> coll = db["foo"]
codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 11
Ruby Driver
irb(main):006:0> coll.remove
=> {"n"=>3, "connectionId"=>2, "err"=>nil, "ok"=>1.0}
irb(main):007:0> coll.insert :hello => "MongoDB"
=> BSON::ObjectId('51d1100ec9f0b10b78000001')
irb(main):008:0> doc = coll.find_one
=>
{"_id"=>BSON::ObjectId('51d1100ec9f0b10b78000001'),
"hello"=>"MongoDB"}
codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 12
Ruby Driver
irb(main):013:0> coll.insert :a => 1, b: [1,2,3,4,5]
=> BSON::ObjectId('51d1108ac9f0b10b78000002')
irb(main):014:0> crsr = coll.find
=> <Mongo::Cursor:0x158e2a8 namespace='test.foo'
@selector={} @cursor_id=>
irb(main):016:0> crsr.each{ |doc| puts doc }
{"_id"=>BSON::ObjectId('51d1100ec9f0b10b78000001'),
"hello"=>"MongoDB"}
{"_id"=>BSON::ObjectId('51d1108ac9f0b10b78000002'),
"a"=>1, "b"=>[1, 2, 3, 4, 5]}
codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 13
Persistence Frameworks
Mongoid
http://mongoid.org/
MongoMapper
http://mongomapper.com/
codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 14
MongoDB User Group Düsseldorf
https://www.xing.com/net/mongodb-dus
@MongoDUS
Meetup #7: Schema Design w/ MongoDB
18.07.2013 19:00
https://www.xing.com/events/7-treffen-schema-
design-mongodb-1268228
MUG Düsseldorf
codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 15
QUESTIONS?
Tobias Trelle
codecentric AG
Merscheider Str. 1
42699 Solingen
tel +49 (0) 212.233628.47
fax +49 (0) 212.233628.79
mail Tobias.Trelle@codecentric.de
twitter @tobiastrelle
www.codecentric.de
blog.codecentric.de/en/author/tobias-trelle
www.xing.com/net/mongodb-dus

More Related Content

What's hot

Блохин Леонид - "Mist, как часть Hydrosphere"
Блохин Леонид - "Mist, как часть Hydrosphere"Блохин Леонид - "Mist, как часть Hydrosphere"
Блохин Леонид - "Mist, как часть Hydrosphere"
Provectus
 
Easy deployment & management of cloud apps
Easy deployment & management of cloud appsEasy deployment & management of cloud apps
Easy deployment & management of cloud apps
David Cunningham
 

What's hot (20)

NoSQL and SQL Anti Patterns
NoSQL and SQL Anti PatternsNoSQL and SQL Anti Patterns
NoSQL and SQL Anti Patterns
 
CouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 HourCouchDB Mobile - From Couch to 5K in 1 Hour
CouchDB Mobile - From Couch to 5K in 1 Hour
 
Блохин Леонид - "Mist, как часть Hydrosphere"
Блохин Леонид - "Mist, как часть Hydrosphere"Блохин Леонид - "Mist, как часть Hydrosphere"
Блохин Леонид - "Mist, как часть Hydrosphere"
 
Yesplan: 10 Years later
Yesplan: 10 Years laterYesplan: 10 Years later
Yesplan: 10 Years later
 
Embulk at Treasure Data
Embulk at Treasure DataEmbulk at Treasure Data
Embulk at Treasure Data
 
ElasticSearch Introduction
ElasticSearch IntroductionElasticSearch Introduction
ElasticSearch Introduction
 
Aggregation APi in Ibexa DXP by Adam Wójs
Aggregation APi in Ibexa DXP by Adam WójsAggregation APi in Ibexa DXP by Adam Wójs
Aggregation APi in Ibexa DXP by Adam Wójs
 
Embuk internals
Embuk internalsEmbuk internals
Embuk internals
 
REST Web API with MongoDB
REST Web API with MongoDBREST Web API with MongoDB
REST Web API with MongoDB
 
Easy deployment & management of cloud apps
Easy deployment & management of cloud appsEasy deployment & management of cloud apps
Easy deployment & management of cloud apps
 
JBoss Fuse Workshop 101 part 6
JBoss Fuse Workshop 101 part 6JBoss Fuse Workshop 101 part 6
JBoss Fuse Workshop 101 part 6
 
High Performance API Mashups with Node.js and ql.io
High Performance API Mashups with Node.js and ql.ioHigh Performance API Mashups with Node.js and ql.io
High Performance API Mashups with Node.js and ql.io
 
Jsonnet, terraform & packer
Jsonnet, terraform & packerJsonnet, terraform & packer
Jsonnet, terraform & packer
 
Scripting Embulk Plugins
Scripting Embulk PluginsScripting Embulk Plugins
Scripting Embulk Plugins
 
Embulk, an open-source plugin-based parallel bulk data loader
Embulk, an open-source plugin-based parallel bulk data loaderEmbulk, an open-source plugin-based parallel bulk data loader
Embulk, an open-source plugin-based parallel bulk data loader
 
Docker Monitoring Webinar
Docker Monitoring  WebinarDocker Monitoring  Webinar
Docker Monitoring Webinar
 
What's new in Ansible 2.0
What's new in Ansible 2.0What's new in Ansible 2.0
What's new in Ansible 2.0
 
Ansible with AWS
Ansible with AWSAnsible with AWS
Ansible with AWS
 
Tamir Dresher - Async Streams in C#
Tamir Dresher - Async Streams in C#Tamir Dresher - Async Streams in C#
Tamir Dresher - Async Streams in C#
 
Automating Workflows for Analytics Pipelines
Automating Workflows for Analytics PipelinesAutomating Workflows for Analytics Pipelines
Automating Workflows for Analytics Pipelines
 

Viewers also liked

Deepak ib solved paper
Deepak ib solved paperDeepak ib solved paper
Deepak ib solved paper
Deepak R Gorad
 
Ppt newton's law
Ppt newton's lawPpt newton's law
Ppt newton's law
mamardc
 
deepak gorad Final csr
deepak gorad Final csrdeepak gorad Final csr
deepak gorad Final csr
Deepak R Gorad
 
Deepak strategic managemt -apple
Deepak  strategic managemt -appleDeepak  strategic managemt -apple
Deepak strategic managemt -apple
Deepak R Gorad
 
Project titles for eee, ece, eie - M.E, B.E, Ph.D, EEE, ECE, EIE Projects
Project titles for  eee, ece, eie - M.E, B.E, Ph.D, EEE, ECE, EIE Projects Project titles for  eee, ece, eie - M.E, B.E, Ph.D, EEE, ECE, EIE Projects
Project titles for eee, ece, eie - M.E, B.E, Ph.D, EEE, ECE, EIE Projects
Senthil Kumar
 
Embedded project list
Embedded project listEmbedded project list
Embedded project list
Senthil Kumar
 

Viewers also liked (20)

Deepak ib solved paper
Deepak ib solved paperDeepak ib solved paper
Deepak ib solved paper
 
Being A Socially Responsible Social Developer: Mobile App Security
Being A Socially Responsible Social Developer: Mobile App SecurityBeing A Socially Responsible Social Developer: Mobile App Security
Being A Socially Responsible Social Developer: Mobile App Security
 
Circuitanlys2
Circuitanlys2Circuitanlys2
Circuitanlys2
 
Dft2
Dft2Dft2
Dft2
 
Ppt newton's law
Ppt newton's lawPpt newton's law
Ppt newton's law
 
XPRESS VACATIONS
XPRESS VACATIONSXPRESS VACATIONS
XPRESS VACATIONS
 
Windows7
Windows7Windows7
Windows7
 
Reechal bday
Reechal bdayReechal bday
Reechal bday
 
Meatco AGM 2012 - CEO Presentation
Meatco AGM 2012 - CEO PresentationMeatco AGM 2012 - CEO Presentation
Meatco AGM 2012 - CEO Presentation
 
Communication projects
Communication projectsCommunication projects
Communication projects
 
Sante1 slideshare
Sante1 slideshareSante1 slideshare
Sante1 slideshare
 
deepak gorad Final csr
deepak gorad Final csrdeepak gorad Final csr
deepak gorad Final csr
 
Power
PowerPower
Power
 
Deepak strategic managemt -apple
Deepak  strategic managemt -appleDeepak  strategic managemt -apple
Deepak strategic managemt -apple
 
Mscc抜粋版
Mscc抜粋版Mscc抜粋版
Mscc抜粋版
 
Entrepreneurship
EntrepreneurshipEntrepreneurship
Entrepreneurship
 
Project titles for eee, ece, eie - M.E, B.E, Ph.D, EEE, ECE, EIE Projects
Project titles for  eee, ece, eie - M.E, B.E, Ph.D, EEE, ECE, EIE Projects Project titles for  eee, ece, eie - M.E, B.E, Ph.D, EEE, ECE, EIE Projects
Project titles for eee, ece, eie - M.E, B.E, Ph.D, EEE, ECE, EIE Projects
 
Drgorad sm project
Drgorad sm projectDrgorad sm project
Drgorad sm project
 
Port folio 20121005
Port folio 20121005Port folio 20121005
Port folio 20121005
 
Embedded project list
Embedded project listEmbedded project list
Embedded project list
 

Similar to An introduction to MongoDB and Ruby

BedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDBBedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDB
Tobias Trelle
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
MongoDB
 
introtomongodb
introtomongodbintrotomongodb
introtomongodb
saikiran
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Alex Bilbie
 
Tikal Fuse Day Access Layer Implementation (C#) Based On Mongo Db
Tikal Fuse Day   Access Layer Implementation (C#) Based On Mongo DbTikal Fuse Day   Access Layer Implementation (C#) Based On Mongo Db
Tikal Fuse Day Access Layer Implementation (C#) Based On Mongo Db
Tikal Knowledge
 

Similar to An introduction to MongoDB and Ruby (20)

BedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDBBedCon 2013 - Java Persistenz-Frameworks für MongoDB
BedCon 2013 - Java Persistenz-Frameworks für MongoDB
 
MongoDB at FrozenRails
MongoDB at FrozenRailsMongoDB at FrozenRails
MongoDB at FrozenRails
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
How to use MongoDB with CakePHP
How to use MongoDB with CakePHPHow to use MongoDB with CakePHP
How to use MongoDB with CakePHP
 
MongoDB
MongoDBMongoDB
MongoDB
 
introtomongodb
introtomongodbintrotomongodb
introtomongodb
 
Morphia, Spring Data & Co.
Morphia, Spring Data & Co.Morphia, Spring Data & Co.
Morphia, Spring Data & Co.
 
MongoDB Introduction and Data Modelling
MongoDB Introduction and Data Modelling MongoDB Introduction and Data Modelling
MongoDB Introduction and Data Modelling
 
DrupalCon Chicago Practical MongoDB and Drupal
DrupalCon Chicago Practical MongoDB and DrupalDrupalCon Chicago Practical MongoDB and Drupal
DrupalCon Chicago Practical MongoDB and Drupal
 
Battle of NoSQL stars: Amazon's SDB vs MongoDB vs CouchDB vs RavenDB
Battle of NoSQL stars: Amazon's SDB vs MongoDB vs CouchDB vs RavenDBBattle of NoSQL stars: Amazon's SDB vs MongoDB vs CouchDB vs RavenDB
Battle of NoSQL stars: Amazon's SDB vs MongoDB vs CouchDB vs RavenDB
 
Code as Data workshop: Using source{d} Engine to extract insights from git re...
Code as Data workshop: Using source{d} Engine to extract insights from git re...Code as Data workshop: Using source{d} Engine to extract insights from git re...
Code as Data workshop: Using source{d} Engine to extract insights from git re...
 
Introduction to MongoDB with PHP
Introduction to MongoDB with PHPIntroduction to MongoDB with PHP
Introduction to MongoDB with PHP
 
Building your first app with MongoDB
Building your first app with MongoDBBuilding your first app with MongoDB
Building your first app with MongoDB
 
Optimizing MongoDB: Lessons Learned at Localytics
Optimizing MongoDB: Lessons Learned at LocalyticsOptimizing MongoDB: Lessons Learned at Localytics
Optimizing MongoDB: Lessons Learned at Localytics
 
Hosting MongoDB & our experience with database as a service
Hosting MongoDB & our experience with database as a serviceHosting MongoDB & our experience with database as a service
Hosting MongoDB & our experience with database as a service
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Tikal Fuse Day Access Layer Implementation (C#) Based On Mongo Db
Tikal Fuse Day   Access Layer Implementation (C#) Based On Mongo DbTikal Fuse Day   Access Layer Implementation (C#) Based On Mongo Db
Tikal Fuse Day Access Layer Implementation (C#) Based On Mongo Db
 
Dev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDBDev Jumpstart: Build Your First App with MongoDB
Dev Jumpstart: Build Your First App with MongoDB
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
 

More from Tobias Trelle

MongoDB - Riesige Datenmengen schemafrei verwalten
MongoDB - Riesige Datenmengen schemafrei verwaltenMongoDB - Riesige Datenmengen schemafrei verwalten
MongoDB - Riesige Datenmengen schemafrei verwalten
Tobias Trelle
 
Morphia, Spring Data & Co
Morphia, Spring Data & CoMorphia, Spring Data & Co
Morphia, Spring Data & Co
Tobias Trelle
 

More from Tobias Trelle (12)

TDD mit JUnit und Mockito
TDD mit JUnit und MockitoTDD mit JUnit und Mockito
TDD mit JUnit und Mockito
 
NoSQL - Einführung in Graphen-Datenbanken mit Neo4j
NoSQL - Einführung in Graphen-Datenbanken mit Neo4jNoSQL - Einführung in Graphen-Datenbanken mit Neo4j
NoSQL - Einführung in Graphen-Datenbanken mit Neo4j
 
Einführung in NoSQL-Datenbanken
Einführung in NoSQL-DatenbankenEinführung in NoSQL-Datenbanken
Einführung in NoSQL-Datenbanken
 
MongoDB Einführung
MongoDB EinführungMongoDB Einführung
MongoDB Einführung
 
MongoDB - Riesige Datenmengen schemafrei verwalten
MongoDB - Riesige Datenmengen schemafrei verwaltenMongoDB - Riesige Datenmengen schemafrei verwalten
MongoDB - Riesige Datenmengen schemafrei verwalten
 
Test Automation for NoSQL Databases
Test Automation for NoSQL DatabasesTest Automation for NoSQL Databases
Test Automation for NoSQL Databases
 
Morphia, Spring Data & Co
Morphia, Spring Data & CoMorphia, Spring Data & Co
Morphia, Spring Data & Co
 
Spring Data, Jongo & Co.
Spring Data, Jongo & Co.Spring Data, Jongo & Co.
Spring Data, Jongo & Co.
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
OOP 2013: Praktische Einführung in MongoDB
OOP 2013: Praktische Einführung in MongoDBOOP 2013: Praktische Einführung in MongoDB
OOP 2013: Praktische Einführung in MongoDB
 
MongoDB Munich 2012: Spring Data MongoDB
MongoDB Munich 2012: Spring Data MongoDBMongoDB Munich 2012: Spring Data MongoDB
MongoDB Munich 2012: Spring Data MongoDB
 
MongoDB Live Hacking
MongoDB Live HackingMongoDB Live Hacking
MongoDB Live Hacking
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Recently uploaded (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

An introduction to MongoDB and Ruby

  • 1. codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 1 MongoDB & Ruby in 10 Minutes Tobias.Trelle@codecentric.de @tobiastrelle
  • 2. codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 2 Tobias Trelle - Senior IT Consultant @ codecentric AG (Düsseldorf) - Organizer of MongoDB User Group Düsseldorf - Authoring a MongoDB book (dpunkt-Verlag)
  • 3. codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 3 MongoDB NoSQL data store / Open Source Single records are called documents Replication & Sharding out-of-the-box Map/Reduce Geospatial Indexes / Queries
  • 4. codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 4 MongoDB Overview Server Database Collection Document Field Tabelle Zeile Spalte Relationales Pendant Aber … Flexibles Schema - Arrays - Rekursiv
  • 5. codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 5 Documents Ordered set of key/values pairs Values can be an array, document or simple type Max size = 16 MB Logical namespaces for documents are called collections Schemaless Format: BSON = Binary JSON != JSON
  • 6. codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 6 Documents {} { hello: "MongoDB" } { foo: { bar: "baz"}, a: [1,2,3,5,8] }
  • 7. codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 7 MongoDB Gems $ gem install mongo Fetching: bson-1.9.0.gem (100%) Fetching: mongo-1.9.0.gem (100%) Successfully installed bson-1.9.0 Successfully installed mongo-1.9.0 2 gems installed ...
  • 8. codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 8 MongoDB Gems $ gem install bson_ext Fetching: bson_ext-1.9.0.gem (100%) Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... Successfully installed bson_ext-1.9.0 1 gem installed...
  • 9. codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 9 Ruby Driver API
  • 10. codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 10 Ruby Driver irb(main):001:0> require 'mongo' => true irb(main):002:0> include Mongo => Object irb(main):003:0> client = MongoClient.new ... irb(main):004:0> db = client["test"] ... irb(main):005:0> coll = db["foo"]
  • 11. codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 11 Ruby Driver irb(main):006:0> coll.remove => {"n"=>3, "connectionId"=>2, "err"=>nil, "ok"=>1.0} irb(main):007:0> coll.insert :hello => "MongoDB" => BSON::ObjectId('51d1100ec9f0b10b78000001') irb(main):008:0> doc = coll.find_one => {"_id"=>BSON::ObjectId('51d1100ec9f0b10b78000001'), "hello"=>"MongoDB"}
  • 12. codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 12 Ruby Driver irb(main):013:0> coll.insert :a => 1, b: [1,2,3,4,5] => BSON::ObjectId('51d1108ac9f0b10b78000002') irb(main):014:0> crsr = coll.find => <Mongo::Cursor:0x158e2a8 namespace='test.foo' @selector={} @cursor_id=> irb(main):016:0> crsr.each{ |doc| puts doc } {"_id"=>BSON::ObjectId('51d1100ec9f0b10b78000001'), "hello"=>"MongoDB"} {"_id"=>BSON::ObjectId('51d1108ac9f0b10b78000002'), "a"=>1, "b"=>[1, 2, 3, 4, 5]}
  • 13. codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 13 Persistence Frameworks Mongoid http://mongoid.org/ MongoMapper http://mongomapper.com/
  • 14. codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 14 MongoDB User Group Düsseldorf https://www.xing.com/net/mongodb-dus @MongoDUS Meetup #7: Schema Design w/ MongoDB 18.07.2013 19:00 https://www.xing.com/events/7-treffen-schema- design-mongodb-1268228 MUG Düsseldorf
  • 15. codecentric AG / Tobias Trelle / MongoDB & Ruby in 10 Minutes 15 QUESTIONS? Tobias Trelle codecentric AG Merscheider Str. 1 42699 Solingen tel +49 (0) 212.233628.47 fax +49 (0) 212.233628.79 mail Tobias.Trelle@codecentric.de twitter @tobiastrelle www.codecentric.de blog.codecentric.de/en/author/tobias-trelle www.xing.com/net/mongodb-dus