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 Different are MongoDB Drivers
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

More Related Content

PDF
MongoDB Europe 2016 - Star in a Reasonably Priced Car - Which Driver is Best?
PDF
How We Fixed Our MongoDB Problems
PPTX
Using Compass to Diagnose Performance Problems in Your Cluster
PPTX
Conceptos Avanzados 1: Motores de Almacenamiento
PDF
MongoDB Europe 2016 - Ops Manager and Cloud Manager
PPTX
Running MongoDB in the Cloud
PDF
A Mobile-First, Cloud-First Stack at Pearson
PDF
Webinar: Serverless Architectures with AWS Lambda and MongoDB Atlas
MongoDB Europe 2016 - Star in a Reasonably Priced Car - Which Driver is Best?
How We Fixed Our MongoDB Problems
Using Compass to Diagnose Performance Problems in Your Cluster
Conceptos Avanzados 1: Motores de Almacenamiento
MongoDB Europe 2016 - Ops Manager and Cloud Manager
Running MongoDB in the Cloud
A Mobile-First, Cloud-First Stack at Pearson
Webinar: Serverless Architectures with AWS Lambda and MongoDB Atlas

What's hot (20)

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

Similar to How Different are MongoDB Drivers (20)

PDF
Do it Yourself Testing
PPTX
MongoDB presentation
PPTX
Dev Jumpstart: Build Your First App with MongoDB
PDF
Node Js, AngularJs and Express Js Tutorial
PPTX
mongodb-brief-intro-february-2012
PPTX
Kalp Corporate MongoDB Tutorials
PDF
Quick & Dirty & MEAN
ODP
Mongo NYC 2011 2011 Windows BOF Session
PDF
Mongo db reference manual
PDF
Mongo db reference-manual
PPTX
MongoDB Introduction, Installation & Execution
PDF
My first moments with MongoDB
PPTX
Java driver for mongo db
PDF
Building Your First MongoDB Application
PDF
Using MongoDB and Python
PDF
2016 feb-23 pyugre-py_mongo
PDF
Mongo db basics
PDF
RubyKaigi 2015-DIY-Testing
PDF
Do it Yourself Testing
MongoDB presentation
Dev Jumpstart: Build Your First App with MongoDB
Node Js, AngularJs and Express Js Tutorial
mongodb-brief-intro-february-2012
Kalp Corporate MongoDB Tutorials
Quick & Dirty & MEAN
Mongo NYC 2011 2011 Windows BOF Session
Mongo db reference manual
Mongo db reference-manual
MongoDB Introduction, Installation & Execution
My first moments with MongoDB
Java driver for mongo db
Building Your First MongoDB Application
Using MongoDB and Python
2016 feb-23 pyugre-py_mongo
Mongo db basics
RubyKaigi 2015-DIY-Testing
Ad

More from Norberto Leite (20)

PDF
Data Modelling for MongoDB - MongoDB.local Tel Aviv
PPTX
Avoid Query Pitfalls
PPTX
MongoDB and Spark
PDF
Mongo db 3.4 Overview
PDF
MongoDB Certification Study Group - May 2016
PDF
Geospatial and MongoDB
PDF
MongodB Internals
PDF
MongoDB WiredTiger Internals
PDF
MongoDB 3.2 Feature Preview
PDF
Mongodb Spring
PDF
MongoDB on Azure
PDF
MongoDB: Agile Combustion Engine
PDF
MongoDB Capacity Planning
PDF
Spark and MongoDB
PDF
Analyse Yourself
PDF
Python and MongoDB
PDF
Strongly Typed Languages and Flexible Schemas
PDF
Effectively Deploying MongoDB on AEM
PPTX
Advanced applications with MongoDB
PDF
MongoDB and Node.js
Data Modelling for MongoDB - MongoDB.local Tel Aviv
Avoid Query Pitfalls
MongoDB and Spark
Mongo db 3.4 Overview
MongoDB Certification Study Group - May 2016
Geospatial and MongoDB
MongodB Internals
MongoDB WiredTiger Internals
MongoDB 3.2 Feature Preview
Mongodb Spring
MongoDB on Azure
MongoDB: Agile Combustion Engine
MongoDB Capacity Planning
Spark and MongoDB
Analyse Yourself
Python and MongoDB
Strongly Typed Languages and Flexible Schemas
Effectively Deploying MongoDB on AEM
Advanced applications with MongoDB
MongoDB and Node.js

Recently uploaded (20)

PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
Consumable AI The What, Why & How for Small Teams.pdf
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
The influence of sentiment analysis in enhancing early warning system model f...
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PPTX
2018-HIPAA-Renewal-Training for executives
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Flame analysis and combustion estimation using large language and vision assi...
PDF
CloudStack 4.21: First Look Webinar slides
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PPT
What is a Computer? Input Devices /output devices
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Module 1.ppt Iot fundamentals and Architecture
Consumable AI The What, Why & How for Small Teams.pdf
Hindi spoken digit analysis for native and non-native speakers
Developing a website for English-speaking practice to English as a foreign la...
The influence of sentiment analysis in enhancing early warning system model f...
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
Final SEM Unit 1 for mit wpu at pune .pptx
2018-HIPAA-Renewal-Training for executives
Custom Battery Pack Design Considerations for Performance and Safety
Enhancing emotion recognition model for a student engagement use case through...
Flame analysis and combustion estimation using large language and vision assi...
CloudStack 4.21: First Look Webinar slides
Credit Without Borders: AI and Financial Inclusion in Bangladesh
What is a Computer? Input Devices /output devices
1 - Historical Antecedents, Social Consideration.pdf
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Convolutional neural network based encoder-decoder for efficient real-time ob...
A comparative study of natural language inference in Swahili using monolingua...
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game

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
  • 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