SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
How different are MongoDB
Drivers?
SA, MongoDB
Norberto Leite
#mongobe
{
"name":"Norberto Leite",
"role":"Solutions Architect",
"company":"MongoDB",
"address": ["Barcelona,Spain”,”Brussels,Belgium”]
"contact": "norberto@mongodb.com",
"likes": {
"beer":"Superbock",
"software": ["Development","python", "go","databases"],
"football":"FC Porto"
}
}
Hi There!
Agenda
•  MongoDB Drivers
•  Community vs Official Supported
•  General Considerations
•  Examples
•  Meta Driver Project
MongoDB Drivers
What’s a Driver?
•  Native Language Library
•  API that exposes methods to operate w/ MongoDB
•  Serialization and Deserialization of native objects/
structures into BSON format
–  http://bsonspec.org
•  Handles the communication and pooling with server
struct MsgHeader {
int32 messageLength; // total message size, including this
int32 requestID; // identifier for this message
int32 responseTo; // requestID from the original request
// (used in reponses from db)
int32 opCode; // request type - see table below
}
Driver Messages
struct OP_INSERT {
MsgHeader header; // standard message header
int32 flags; // bit vector - see below
cstring fullCollectionName; // "dbname.collectionname"
document* documents; // one or more documents to insert
into the collection
}
Insert Message
struct OP_QUERY {
MsgHeader header; // standard message header
int32 flags; // bit vector of query options. See below for det
cstring fullCollectionName ; // "dbname.collectionname"
int32 numberToSkip; // number of documents to skip
int32 numberToReturn; // number of documents to return
// in the first OP_REPLY batch
document query; // query object. See below for details.
[ document returnFieldsSelector; ] // Optional. Selector indicating the fiel
// to return. See below for details.
}
Query Message
How many drivers ?
•  A few
How many drivers?
•  13 officially supported drivers
–  Python
–  Java
–  C / C++ / C#
–  PHP
–  Node.js
–  Perl
–  Ruby
–  Scala
–  …
http://docs.mongodb.org/ecosystem/drivers/
How many drivers?
•  Community Supported
–  Matlab
–  R
–  Go
–  Clojure
–  Dart
–  Erlang
–  Prolog
–  …
http://docs.mongodb.org/ecosystem/drivers/community-supported-drivers/
Community vs Official Supported
Don’t take the RED PILL!
Things to consider
•  Official driver means:
–  We have dedicated resources to work on the driver
–  Constant delivery and updated with server version
–  Support includes fixes for drivers
•  Some community drivers are also maintained by
MongoDB engineers
–  mongoengine
–  motor
–  …
But most important
Use the best tool for the
problem!
Language Ecosystem
Python
•  Official Driver
–  pymongo
•  Frameworks | ODMs
–  mongoengine
–  minimongo
–  Manga
•  Alternative Drivers
–  Asynchronous
•  Motor
•  TxMongo
> pip install pymongo
//or
> easy_install pymongo
//using ipython
> ipython
>> from pymongo import MongoClient
>> mc = MongoClient()
Python
Node.js
•  Official Driver
–  http://mongodb.github.io/node-mongodb-native/
•  ODM
–  Mongose
•  http://mongoosejs.com/
•  Others
–  Mongoskin
–  Mongolia
http://docs.mongodb.org/ecosystem/drivers/node-js/
> node
>> var MongoClient = require("mongodb").MongoClient
>> MongoClient.connect( "mongodb://nair.local:27017",
function(err, db){
if(!err) {console.log("we are connected");}
});
>> var col = db.collection("sample");
Node.js
Java
•  Official Driver
–  http://api.mongodb.org/java/current/index.html
•  Multiple Frameworks
–  Morphya
–  DataNucleus JPA/JDO
–  Jongo
•  JVM Languages
–  Scala
–  Clojure
–  Groovy
Clojure
(ns my.service.server
(:require [monger.core :as mg])
(:import [com.mongodb MongoOptions ServerAddress]))

;; localhost, default port
(mg/connect!)

;; set default database using set-db
(mg/set-db! (mg/get-db "monger-test"))
Clojure
Go
•  Not officially supported driver!
•  mgo Library
–  http://labix.org/mgo
–  Really cool!
–  We use it internally for some projects
•  Others
–  gomongo
–  go-mongo
Let’s get some code Running!
MongoDB Meta Driver Project
Meta Driver
•  http://docs.mongodb.org/meta-driver/latest/
•  Help new drivers to be built by the community
•  Basic structure and conventions documentation
•  Beta Project–Under Development
Obrigado!
norberto@mongodb.com
Norberto Leite
@nleite

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

MongoDB Launchpad 2016: MongoDB 3.4: Your Database Evolved
MongoDB Launchpad 2016: MongoDB 3.4: Your Database EvolvedMongoDB Launchpad 2016: MongoDB 3.4: Your Database Evolved
MongoDB Launchpad 2016: MongoDB 3.4: Your Database Evolved
 
MongoDB Europe 2016 - Powering Microservices with Docker, Kubernetes, and Kafka
MongoDB Europe 2016 - Powering Microservices with Docker, Kubernetes, and KafkaMongoDB Europe 2016 - Powering Microservices with Docker, Kubernetes, and Kafka
MongoDB Europe 2016 - Powering Microservices with Docker, Kubernetes, and Kafka
 
How Thermo Fisher is Reducing Data Analysis Times from Days to Minutes with M...
How Thermo Fisher is Reducing Data Analysis Times from Days to Minutes with M...How Thermo Fisher is Reducing Data Analysis Times from Days to Minutes with M...
How Thermo Fisher is Reducing Data Analysis Times from Days to Minutes with M...
 
Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)
Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)
Developing with the Modern App Stack: MEAN and MERN (with Angular2 and ReactJS)
 
Building Real World Application with Azure
Building Real World Application with AzureBuilding Real World Application with Azure
Building Real World Application with Azure
 
Why Wordnik went non-relational
Why Wordnik went non-relationalWhy Wordnik went non-relational
Why Wordnik went non-relational
 
MongoDB .local Bengaluru 2019: Using MongoDB Services in Kubernetes: Any Plat...
MongoDB .local Bengaluru 2019: Using MongoDB Services in Kubernetes: Any Plat...MongoDB .local Bengaluru 2019: Using MongoDB Services in Kubernetes: Any Plat...
MongoDB .local Bengaluru 2019: Using MongoDB Services in Kubernetes: Any Plat...
 
An Introduction to MongoDB Ops Manager
An Introduction to MongoDB Ops ManagerAn Introduction to MongoDB Ops Manager
An Introduction to MongoDB Ops Manager
 
Webinar: Enabling Microservices with Containers, Orchestration, and MongoDB
Webinar: Enabling Microservices with Containers, Orchestration, and MongoDBWebinar: Enabling Microservices with Containers, Orchestration, and MongoDB
Webinar: Enabling Microservices with Containers, Orchestration, and MongoDB
 
Accelerating the Path to Digital with a Cloud Data Strategy
Accelerating the Path to Digital with a Cloud Data StrategyAccelerating the Path to Digital with a Cloud Data Strategy
Accelerating the Path to Digital with a Cloud Data Strategy
 
MongoDB Europe 2016 - Warehousing MongoDB Data using Apache Beam and BigQuery
MongoDB Europe 2016 - Warehousing MongoDB Data using Apache Beam and BigQueryMongoDB Europe 2016 - Warehousing MongoDB Data using Apache Beam and BigQuery
MongoDB Europe 2016 - Warehousing MongoDB Data using Apache Beam and BigQuery
 
The Rise of Microservices - Containers and Orchestration
The Rise of Microservices - Containers and OrchestrationThe Rise of Microservices - Containers and Orchestration
The Rise of Microservices - Containers and Orchestration
 
MongoDB .local Toronto 2019: Finding the Right Atlas Cluster Size: Does this ...
MongoDB .local Toronto 2019: Finding the Right Atlas Cluster Size: Does this ...MongoDB .local Toronto 2019: Finding the Right Atlas Cluster Size: Does this ...
MongoDB .local Toronto 2019: Finding the Right Atlas Cluster Size: Does this ...
 
Powering Microservices with Docker, Kubernetes, Kafka, & MongoDB
Powering Microservices with Docker, Kubernetes, Kafka, & MongoDBPowering Microservices with Docker, Kubernetes, Kafka, & MongoDB
Powering Microservices with Docker, Kubernetes, Kafka, & MongoDB
 
MongoDB @ Fiverr: The Road to Atlas
MongoDB @ Fiverr: The Road to AtlasMongoDB @ Fiverr: The Road to Atlas
MongoDB @ Fiverr: The Road to Atlas
 
MongoDB Introduction talk at Dr Dobbs Conference, MongoDB Evenings at Bangalo...
MongoDB Introduction talk at Dr Dobbs Conference, MongoDB Evenings at Bangalo...MongoDB Introduction talk at Dr Dobbs Conference, MongoDB Evenings at Bangalo...
MongoDB Introduction talk at Dr Dobbs Conference, MongoDB Evenings at Bangalo...
 
Building an E-commerce website in MEAN stack
Building an E-commerce website in MEAN stackBuilding an E-commerce website in MEAN stack
Building an E-commerce website in MEAN stack
 
MongoDB Europe 2016 - Deploying MongoDB on NetApp storage
MongoDB Europe 2016 - Deploying MongoDB on NetApp storageMongoDB Europe 2016 - Deploying MongoDB on NetApp storage
MongoDB Europe 2016 - Deploying MongoDB on NetApp storage
 
MongoDB .local Bengaluru 2019: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local Bengaluru 2019: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local Bengaluru 2019: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local Bengaluru 2019: MongoDB Atlas Data Lake Technical Deep Dive
 
Creating Real-Time Data Mashups with Node.js and Adobe CQ by Josh Miller
Creating Real-Time Data Mashups with Node.js and Adobe CQ by Josh MillerCreating Real-Time Data Mashups with Node.js and Adobe CQ by Josh Miller
Creating Real-Time Data Mashups with Node.js and Adobe CQ by Josh Miller
 

Ähnlich wie How Different are MongoDB Drivers

Mongo db first steps with csharp
Mongo db first steps with csharpMongo db first steps with csharp
Mongo db first steps with csharp
Serdar Buyuktemiz
 
Mongo NYC PHP Development
Mongo NYC PHP Development Mongo NYC PHP Development
Mongo NYC PHP Development
Fitz Agard
 
MongoDB and Ruby on Rails
MongoDB and Ruby on RailsMongoDB and Ruby on Rails
MongoDB and Ruby on Rails
rfischer20
 
Mongodb at-gilt-groupe-seattle-2012-09-14-final
Mongodb at-gilt-groupe-seattle-2012-09-14-finalMongodb at-gilt-groupe-seattle-2012-09-14-final
Mongodb at-gilt-groupe-seattle-2012-09-14-final
MongoDB
 
MongoDB at Gilt Groupe
MongoDB at Gilt GroupeMongoDB at Gilt Groupe
MongoDB at Gilt Groupe
MongoDB
 
Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18
Pierre Joye
 

Ähnlich wie How Different are MongoDB Drivers (20)

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
 
Mongo db first steps with csharp
Mongo db first steps with csharpMongo db first steps with csharp
Mongo db first steps with csharp
 
MongoDB Basics
MongoDB BasicsMongoDB Basics
MongoDB Basics
 
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
 
Mongo NYC PHP Development
Mongo NYC PHP Development Mongo NYC PHP Development
Mongo NYC PHP Development
 
MongoDB and Ruby on Rails
MongoDB and Ruby on RailsMongoDB and Ruby on Rails
MongoDB and Ruby on Rails
 
Metaprogramming Go
Metaprogramming GoMetaprogramming Go
Metaprogramming Go
 
Apache Cordova 4.x
Apache Cordova 4.xApache Cordova 4.x
Apache Cordova 4.x
 
Mongodb at-gilt-groupe-seattle-2012-09-14-final
Mongodb at-gilt-groupe-seattle-2012-09-14-finalMongodb at-gilt-groupe-seattle-2012-09-14-final
Mongodb at-gilt-groupe-seattle-2012-09-14-final
 
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
PHPFrameworkDay 2020 - Different software evolutions from Start till Release ...
 
"Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa..."Different software evolutions from Start till Release in PHP product" Oleksa...
"Different software evolutions from Start till Release in PHP product" Oleksa...
 
Building your first app with MongoDB
Building your first app with MongoDBBuilding your first app with MongoDB
Building your first app with MongoDB
 
Using MongoDB For BigData in 20 Minutes
Using MongoDB For BigData in 20 MinutesUsing MongoDB For BigData in 20 Minutes
Using MongoDB For BigData in 20 Minutes
 
MongoDB at Gilt Groupe
MongoDB at Gilt GroupeMongoDB at Gilt Groupe
MongoDB at Gilt Groupe
 
Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18
 
Conceptos básicos. Seminario web 6: Despliegue de producción
Conceptos básicos. Seminario web 6: Despliegue de producciónConceptos básicos. Seminario web 6: Despliegue de producción
Conceptos básicos. Seminario web 6: Despliegue de producción
 
Dataweek-Talk-2014
Dataweek-Talk-2014Dataweek-Talk-2014
Dataweek-Talk-2014
 
Apache Cordova
Apache CordovaApache Cordova
Apache Cordova
 
Building Social IRC Bots with Node.js and MongoDB
Building Social IRC Bots with Node.js and MongoDBBuilding Social IRC Bots with Node.js and MongoDB
Building Social IRC Bots with Node.js and MongoDB
 
Pymongo password change made easy
Pymongo password change made easyPymongo password change made easy
Pymongo password change made easy
 

Mehr von Norberto Leite

Spark and MongoDB
Spark and MongoDBSpark and MongoDB
Spark and MongoDB
Norberto Leite
 

Mehr von Norberto Leite (20)

Data Modelling for MongoDB - MongoDB.local Tel Aviv
Data Modelling for MongoDB - MongoDB.local Tel AvivData Modelling for MongoDB - MongoDB.local Tel Aviv
Data Modelling for MongoDB - MongoDB.local Tel Aviv
 
Avoid Query Pitfalls
Avoid Query PitfallsAvoid Query Pitfalls
Avoid Query Pitfalls
 
MongoDB and Spark
MongoDB and SparkMongoDB and Spark
MongoDB and Spark
 
Mongo db 3.4 Overview
Mongo db 3.4 OverviewMongo db 3.4 Overview
Mongo db 3.4 Overview
 
MongoDB Certification Study Group - May 2016
MongoDB Certification Study Group - May 2016MongoDB Certification Study Group - May 2016
MongoDB Certification Study Group - May 2016
 
Geospatial and MongoDB
Geospatial and MongoDBGeospatial and MongoDB
Geospatial and MongoDB
 
MongodB Internals
MongodB InternalsMongodB Internals
MongodB Internals
 
MongoDB WiredTiger Internals
MongoDB WiredTiger InternalsMongoDB WiredTiger Internals
MongoDB WiredTiger Internals
 
MongoDB 3.2 Feature Preview
MongoDB 3.2 Feature PreviewMongoDB 3.2 Feature Preview
MongoDB 3.2 Feature Preview
 
Mongodb Spring
Mongodb SpringMongodb Spring
Mongodb Spring
 
MongoDB on Azure
MongoDB on AzureMongoDB on Azure
MongoDB on Azure
 
MongoDB: Agile Combustion Engine
MongoDB: Agile Combustion EngineMongoDB: Agile Combustion Engine
MongoDB: Agile Combustion Engine
 
MongoDB Capacity Planning
MongoDB Capacity PlanningMongoDB Capacity Planning
MongoDB Capacity Planning
 
Spark and MongoDB
Spark and MongoDBSpark and MongoDB
Spark and MongoDB
 
Analyse Yourself
Analyse YourselfAnalyse Yourself
Analyse Yourself
 
Python and MongoDB
Python and MongoDB Python and MongoDB
Python and MongoDB
 
Strongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible SchemasStrongly Typed Languages and Flexible Schemas
Strongly Typed Languages and Flexible Schemas
 
Effectively Deploying MongoDB on AEM
Effectively Deploying MongoDB on AEMEffectively Deploying MongoDB on AEM
Effectively Deploying MongoDB on AEM
 
Advanced applications with MongoDB
Advanced applications with MongoDBAdvanced applications with MongoDB
Advanced applications with MongoDB
 
MongoDB and Node.js
MongoDB and Node.jsMongoDB and Node.js
MongoDB and Node.js
 

Kürzlich hochgeladen

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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
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...
 
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
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
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
 

How Different are MongoDB Drivers

  • 1. How different are MongoDB Drivers? SA, MongoDB Norberto Leite #mongobe
  • 2. { "name":"Norberto Leite", "role":"Solutions Architect", "company":"MongoDB", "address": ["Barcelona,Spain”,”Brussels,Belgium”] "contact": "norberto@mongodb.com", "likes": { "beer":"Superbock", "software": ["Development","python", "go","databases"], "football":"FC Porto" } } Hi There!
  • 3. Agenda •  MongoDB Drivers •  Community vs Official Supported •  General Considerations •  Examples •  Meta Driver Project
  • 5. What’s a Driver? •  Native Language Library •  API that exposes methods to operate w/ MongoDB •  Serialization and Deserialization of native objects/ structures into BSON format –  http://bsonspec.org •  Handles the communication and pooling with server
  • 6. struct MsgHeader { int32 messageLength; // total message size, including this int32 requestID; // identifier for this message int32 responseTo; // requestID from the original request // (used in reponses from db) int32 opCode; // request type - see table below } Driver Messages
  • 7. struct OP_INSERT { MsgHeader header; // standard message header int32 flags; // bit vector - see below cstring fullCollectionName; // "dbname.collectionname" document* documents; // one or more documents to insert into the collection } Insert Message
  • 8. struct OP_QUERY { MsgHeader header; // standard message header int32 flags; // bit vector of query options. See below for det cstring fullCollectionName ; // "dbname.collectionname" int32 numberToSkip; // number of documents to skip int32 numberToReturn; // number of documents to return // in the first OP_REPLY batch document query; // query object. See below for details. [ document returnFieldsSelector; ] // Optional. Selector indicating the fiel // to return. See below for details. } Query Message
  • 9. How many drivers ? •  A few
  • 10.
  • 11. How many drivers? •  13 officially supported drivers –  Python –  Java –  C / C++ / C# –  PHP –  Node.js –  Perl –  Ruby –  Scala –  … http://docs.mongodb.org/ecosystem/drivers/
  • 12. How many drivers? •  Community Supported –  Matlab –  R –  Go –  Clojure –  Dart –  Erlang –  Prolog –  … http://docs.mongodb.org/ecosystem/drivers/community-supported-drivers/
  • 14. Don’t take the RED PILL!
  • 15. Things to consider •  Official driver means: –  We have dedicated resources to work on the driver –  Constant delivery and updated with server version –  Support includes fixes for drivers •  Some community drivers are also maintained by MongoDB engineers –  mongoengine –  motor –  …
  • 16. But most important Use the best tool for the problem!
  • 18. Python •  Official Driver –  pymongo •  Frameworks | ODMs –  mongoengine –  minimongo –  Manga •  Alternative Drivers –  Asynchronous •  Motor •  TxMongo
  • 19. > pip install pymongo //or > easy_install pymongo //using ipython > ipython >> from pymongo import MongoClient >> mc = MongoClient() Python
  • 20. Node.js •  Official Driver –  http://mongodb.github.io/node-mongodb-native/ •  ODM –  Mongose •  http://mongoosejs.com/ •  Others –  Mongoskin –  Mongolia http://docs.mongodb.org/ecosystem/drivers/node-js/
  • 21. > node >> var MongoClient = require("mongodb").MongoClient >> MongoClient.connect( "mongodb://nair.local:27017", function(err, db){ if(!err) {console.log("we are connected");} }); >> var col = db.collection("sample"); Node.js
  • 22. Java •  Official Driver –  http://api.mongodb.org/java/current/index.html •  Multiple Frameworks –  Morphya –  DataNucleus JPA/JDO –  Jongo •  JVM Languages –  Scala –  Clojure –  Groovy
  • 24. (ns my.service.server (:require [monger.core :as mg]) (:import [com.mongodb MongoOptions ServerAddress])) ;; localhost, default port (mg/connect!) ;; set default database using set-db (mg/set-db! (mg/get-db "monger-test")) Clojure
  • 25. Go •  Not officially supported driver! •  mgo Library –  http://labix.org/mgo –  Really cool! –  We use it internally for some projects •  Others –  gomongo –  go-mongo
  • 26. Let’s get some code Running!
  • 28. Meta Driver •  http://docs.mongodb.org/meta-driver/latest/ •  Help new drivers to be built by the community •  Basic structure and conventions documentation •  Beta Project–Under Development