SlideShare a Scribd company logo
1 of 92
MongoDB + Node.js
Building first app with MongoDB and Node.js
3
Agenda
MongoDB + Node.js
Driver
ODM's
MEAN Stack
Meteor
4
Ola, I'm Norberto!
Norberto Leite
Technical Evangelist
Madrid, Spain
@nleite
norberto@mongodb.com
http://www.mongodb.com/norberto
MongoDB Node.js
INFACT
MongoDB JavaScript
8
Few reasons why
Flexible Agile
Web
Language
9
MongoDB + Javascript
• MongoDB Shell
– JS interperter
• MongoDB MapReduce
– Runs on top of V8
– Map and Reduce functions are JS functions
• Native support for Node.js
– One of the most used Drivers out there!
– https://www.npmjs.com/package/mongodb
Node.js
11
2 Foundations
Events Streams
12
2 Foundations
• Events / Event Loop
– Single Thread Applications
– No threads
– Events Emitter
– Event Queue
– Known Events
• Streams
– Read, Write, Both
– Unix Pipes
– We use it extensively!
Install
npm package
$ npm install mongodb
Compatibility
http://docs.mongodb.org/ecosystem/drivers/node-js/#compatibility
16
Compatibility w/ MongoDB
Initialize Project
package.json file
$ mkdir firstappnodejs
$ cd firstappnodejs
$ npm init
package.json file
$ mkdir firstappnodejs
$ cd firstappnodejs
$ npm init
...
{
"name": "firstappnodejs",
"version": "0.0.1",
"description": "Small demo webinar application",
"main": "index.js",
"scripts": {
"test": "workitout"
},
"repository": {
"type": "git",
"url": "git://github.com/nleite/firstappnodejs"
},
"dependencies": {
"mongodb": "~2.0"
},
"keywords": [http://docs.mongodb.org/ecosystem/drivers/node-js/#compatibility
"demo",
"nodejs",
"mongodb"
],
"author": "Norberto Leite",
"license": "Apache 2.0",
"bugs": {
"url": "https://github.com/nleite/firstappnodejs/issues"
},
"homepage": "https://github.com/nleite/firstappnodejs"
package.json file
$ mkdir firstappnodejs
$ cd firstappnodejs
$ npm init
...
{
"name": "firstappnodejs",
"version": "0.0.1",
"description": "Small demo webinar application",
"main": "index.js",
"scripts": {
"test": "workitout"
},
"repository": {
"type": "git",
"url": "git://github.com/nleite/firstappnodejs"
},
"dependencies": {
"mongodb": "~2.0"
},
"keywords": [
"demo",
"nodejs",
"mongodb"
],
"author": "Norberto Leite",
"license": "Apache 2.0",
"bugs": {
"url": "https://github.com/nleite/firstappnodejs/issues"
},
"homepage": "https://github.com/nleite/firstappnodejs"
Install our new firstappnodejs app!
$ npm install
> kerberos@0.0.10 install …
…
> bson@0.3.1 install
> mongodb@2.0.28 node_modules/mongodb
├── readable-stream@1.0.31 (isarray@0.0.1, inherits@2.0.1,
string_decoder@0.10.31, core-util-is@1.0.1)
└── mongodb-core@1.1.25 (kerberos@0.0.10, bson@0.3.1)
firstappnodejs/ $ ls
node_modules package.json
Connect
boot up MongoDB Server
$ mkdir ~/firstappdb
$ mongod --dbpath ~/firstappdb
boot up MongoDB Server
$ mkdir ~/firstappdb
$ mongod --dbpath ~/firstappdb --auth
--keyfile ~/n.pem
https://www.mongodb.com/products/mongodb-enterprise-advanced
boot up MongoDB Server
$ mkdir ~/firstappdb
$ mongod --dbpath ~/firstappdb --auth
--keyfile ~/n.pem
https://www.mongodb.com/products/mongodb-enterprise-advanced
var MongoClient = require('mongodb').MongoClient,
assert = require('assert');
Connect
var MongoClient = require('mongodb').MongoClient,
assert = require('assert');
//connection uri
var uri = "mongodb://localhost:27017/firstapp"
Connect
var MongoClient = require('mongodb').MongoClient,
assert = require('assert');
//connection uri
var uri = "mongodb://localhost:27017/firstapp"
//connect to MongoDB
MongoClient.connect(uri, function(err, db){
assert.equal(null, err);
console.log("Connected correctly to server");
db.close();
});
Connect
29
Connection Pooling
• No traditional Pooling mechanism
– Single thread process
• Sockets to pipeline operations
• Failover
– Buffering up operations
– bufferMaxEntries
– numberOfRetries
– retryMiliSeconds
http://mongodb.github.io/node-mongodb-native/2.0/api/Db.html
CRUD
var insertDocuments = function(db, cb){
//we don't need to explicitly create a collection
var collection = db.collection('myCollection');
collection.insertMany([
{"mongodb": "is just awesome"},
{"nodejs": "so awesome"}
], function(err, result){
assert.equal(null, err);
//inserted 2 documents
assert.equal(2, result.insertedCount);
//invoke callback
cb(result);
});
}
Insert
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert
var insertDocuments = function(db, cb){
//we don't need to explicitly create a collection
var collection = db.collection('myCollection');
collection.insertMany([
{"mongodb": "is just awesome"},
{"nodejs": "so awesome"}
], function(err, result){
assert.equal(null, err);
//inserted 2 documents
assert.equal(2, result.insertedCount);
//invoke callback
cb(result);
});
}
Insert
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert
var insertDocuments = function(db, cb){
//we don't need to explicitly create a collection
var collection = db.collection('myCollection');
collection.insertMany([
{"mongodb": "is just awesome"},
{"nodejs": "so awesome"}
], function(err, result){
assert.equal(null, err);
//inserted 2 documents
assert.equal(2, result.insertedCount);
//invoke callback
cb(result);
});
}
Insert
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert
var insertDocuments = function(db, cb){
//we don't need to explicitly create a collection
var collection = db.collection('myCollection');
collection.insertMany([
{"mongodb": "is just awesome"},
{"nodejs": "so awesome"}
], function(err, result){
assert.equal(null, err);
//inserted 2 documents
assert.equal(2, result.insertedCount);
//invoke callback
cb(result);
});
}
Insert
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert
MongoClient.connect(uri, function(err, db) {
assert.equal(null, err);
console.log("Sweet! Talking to Server");
insertDocuments(db, function() {
db.close();
});
});
Insert
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert
MongoClient.connect(uri, function(err, db) {
assert.equal(null, err);
console.log("Sweet! Talking to Server");
insertDocuments(db, function() {
db.close();
});
});
Insert
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert
var updateDocument = function(db, cb){
var collection = db.collection("myCollection");
collection.updateOne( {"mongodb": "is just awesome"},
{$set: {"users": ["nleite"]}}, function( err, result){
assert.equal(null, err);
assert.equal(1, result.modifiedCount);
console.log("Cool, just updated");
cb(result);
});
}
Update
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update
var updateDocument = function(db, cb){
var collection = db.collection("myCollection");
collection.updateOne( {"mongodb": "is just awesome"},
{$set: {"users": ["nleite"]}}, function( err, result){
assert.equal(null, err);
assert.equal(1, result.modifiedCount);
console.log("Cool, just updated");
cb(result);
});
}
Update
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update
var updateDocument = function(db, cb){
var collection = db.collection("myCollection");
collection.updateOne( {"mongodb": "is just awesome"},
{$set: {"users": ["nleite"]}}, function( err, result){
assert.equal(null, err);
assert.equal(1, result.modifiedCount);
console.log("Cool, just updated");
cb(result);
});
}
Update
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update
var updateDocument = function(db, cb){
var collection = db.collection("myCollection");
collection.updateOne( {"mongodb": "is just awesome"},
{$set: {"users": ["nleite"]}}, function( err, result){
assert.equal(null, err);
assert.equal(1, result.modifiedCount);
console.log("Cool, just updated");
cb(result);
});
}
Update
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update
MongoClient.connect(uri, function(err, db) {
assert.equal(null, err);
console.log("Ok, I can now update!");
updateDocuments(db, function() {
db.close();
});
});
Update
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update
Remove
var removeDocument = function(db, cb){
var collection = db.collection("myCollection");
collection.deleteOne( {"users": "nleite"},
function( err, result){
assert.equal(null, err);
assert.equal(1, result.deletedCount);
console.log("purged the @nleite contaminated
data!");
cb(result);
});
}
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#remove
Remove
var removeDocument = function(db, cb){
var collection = db.collection("myCollection");
collection.deleteOne( {"users": "nleite"},
function( err, result){
assert.equal(null, err);
assert.equal(1, result.deletedCount);
console.log("purged the @nleite contaminated
data!");
cb(result);
});
}
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#remove
Remove
var removeDocument = function(db, cb){
var collection = db.collection("myCollection");
collection.deleteOne( {"users": "nleite"},
function( err, result){
assert.equal(null, err);
assert.equal(1, result.deletedCount);
console.log("purged the @nleite contaminated
data!");
cb(result);
});
}
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#remove
Remove
MongoClient.connect(uri, function(err, db) {
assert.equal(null, err);
console.log("Ok, I can now delete!");
removeDocuments(db, function() {
db.close();
});
});
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#remove
Find
var findAllDocuments = function(db, cb){
var collection = db.collection('myDocuments');
//or collection.find()
collection.find({}).toArray(function(err, docs){
assert.equal(err, null);
assert.equal(1, docs.length);
console.log("Gotcha! found "+ docs.length);
console.dir(docs);
cb(docs);
});
}
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#find
Find
var findAllDocuments = function(db, cb){
var collection = db.collection('myDocuments');
//or collection.find()
collection.find({}).toArray(function(err, docs){
assert.equal(err, null);
assert.equal(1, docs.length);
console.log("Gotcha! found "+ docs.length);
console.dir(docs);
cb(docs);
});
}
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#find
Find
var findAllDocuments = function(db, cb){
var collection = db.collection('myDocuments');
//or collection.find()
collection.find({}).toArray(function(err, docs){
assert.equal(err, null);
assert.equal(1, docs.length);
console.log("Gotcha! found "+ docs.length);
console.dir(docs);
cb(docs);
});
}
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#find
Flexibility
Schema Flexibility
Different Schemas
var insertDifferentShapes = function(db, cb){
var doc1 = {"name": "Norberto", "talks": [
{"nodejs":10}, {"java":15}, "python":11]};
var doc2 = {"name": "Bryan", "webinars": 30};
var coll = db.collection("content")
coll.insertMany( [doc1, doc2], function(err, result){
assert.equal(err, null);
assert.equal(2, result.insertedCount);
console.log("Sweet, inserted "+ result.insertedCount);
cb(result);
});
}
http://docs.mongodb.org/manual/data-modeling/
Different Schemas
var insertDifferentShapes = function(db, cb){
var doc1 = {"name": "Norberto", "talks": [
{"nodejs":10}, {"java":15}, "python":11]};
var doc2 = {"name": "Bryan", "webinars": 30};
var coll = db.collection("content")
coll.insertMany( [doc1, doc2], function(err, result){
assert.equal(err, null);
assert.equal(2, result.insertedCount);
console.log("Sweet, inserted "+ result.insertedCount);
cb(result);
});
}
http://docs.mongodb.org/manual/data-modeling/
WriteConcerns
WriteConcern w:1
WriteConcern w:2
WriteConcern j:true
Different WriteConcerns
var insertSuperImportant = function(db, cb){
var customer = {"name": "Manny Delgado", "age": 14};
var coll = db.collection("customers");
var writeConcern = {"w": "majority"};
col.insertOne( customer, writeConcern, function(err, result){
assert.equal(err, null);
assert.equal(1, result.insertedCount);
console.log("Inserted super important record");
cb(result);
});
}
http://mongodb.github.io/node-mongodb-native/2.0/api/WriteConcernError.html
Different WriteConcerns
var insertSuperImportant = function(db, cb){
var customer = {"name": "Manny Delgado", "age": 14};
var coll = db.collection("customers");
var writeConcern = {"w": "majority"};
col.insertOne( customer, writeConcern, function(err, result){
assert.equal(err, null);
assert.equal(1, result.insertedCount);
console.log("Inserted super important record");
cb(result);
});
}
http://mongodb.github.io/node-mongodb-native/2.0/api/WriteConcernError.html
Read Preference
60
Read Preference
• Read from Primary (default)
ReadPreference.PRIMARY
• Read from Primary Preferably
ReadPreference.PRIMARY_PREFERRED
• Read from Secondary
ReadPreference.SECONDARY
• Read from Secondary Preferably
ReadPreference.SECONDARY_PREFERRED
• Read from Nearest Node
ReadPreference.NEAREST
http://mongodb.github.io/node-mongodb-native/2.0/api/ReadPreference.html
Read From Nearest
var readNearestWaterMelonColor = function(db, cb){
var rp = ReadPreference.NEAREST;
var coll = db.collection("products", {ReadPreference:rp});
var query = {"color": "water melon green"};
collection.find(query).toArray(function(err, docs){
assert.equal(err, null);
assert.equal(1, docs.length);
console.log("So many products: "+ docs.length);
console.dir(docs);
cb(docs);
});
}
http://mongodb.github.io/node-mongodb-native/2.0/api/ReadPreference.html
Read From Nearest
var readNearestWaterMelonColor = function(db, cb){
var rp = ReadPreference.NEAREST;
var coll = db.collection("products", {ReadPreference:rp});
var query = {"color": "water melon green"};
collection.find(query).toArray(function(err, docs){
assert.equal(err, null);
assert.equal(1, docs.length);
console.log("So many products: "+ docs.length);
console.dir(docs);
cb(docs);
});
}
http://mongodb.github.io/node-mongodb-native/2.0/api/ReadPreference.html
Read From Nearest
var readNearestWaterMelonColor = function(db, cb){
var rp = ReadPreference.NEAREST;
var coll = db.collection("products", {readPreference:rp});
var query = {"color": "water melon green"};
collection.find(query).toArray(function(err, docs){
assert.equal(err, null);
assert.equal(1, docs.length);
console.log("So many products: "+ docs.length);
console.dir(docs);
cb(docs);
});
}
http://mongodb.github.io/node-mongodb-native/2.0/api/ReadPreference.html
Aggregation
Aggregation
var aggregateAvgAgeGender = function( db, cb){
//{age:XX, name:"user name", gender: "M/F"}
var pipeline = [
{$group: { "_id": "$gender", avg_age: {$avg: "$age"}}},
];
var coll = db.collection("users");
var cursor = coll.aggregate(pipeline);
cursor.forEach( function(x){
console.log("Gender " + x._id + " age average " + x.avg_age)
}, function(x) {
cb(cursor);
});
}
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#aggregate
Aggregation
var aggregateAvgAgeGender = function( db, cb){
//{age:XX, name:"user name", gender: "M/F"}
var pipeline = [
{$group: { "_id": "$gender", avg_age: {$avg: "$age"}}},
];
var coll = db.collection("users");
var cursor = coll.aggregate(pipeline);
cursor.forEach( function(x){
console.log("Gender " + x._id + " age average " + x.avg_age)
}, function(x) {
cb(cursor);
});
}
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#aggregate
Aggregation
var aggregateAvgAgeGender = function( db, cb){
//{age:XX, name:"user name", gender: "M/F"}
var pipeline = [
{$group: { "_id": "$gender", avg_age: {$avg: "$age"}}},
];
var coll = db.collection("users");
var cursor = coll.aggregate(pipeline);
cursor.forEach( function(x){
console.log("Gender " + x._id + " age average " + x.avg_age)
}, function(x) {
cb(cursor);
});
}
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#aggregate
Aggregation
var aggregateAvgAgeGender = function( db, cb){
//{age:XX, name:"user name", gender: "M/F"}
var pipeline = [
{$match:{"age": $gt: 18}},
{$group: { "_id": "$gender", avg_age: {$avg: "$age"}}},
{$project:{"ID": "$_id", "average": "$avg_age" }}
];
var cursor = coll.aggregate(pipeline);
var coll = db.collection("users");
cursor.forEach( function(x){
console.log("Gender " + x._id + " age average " + x.avg_age)
}, function(x) {
cb(cursor);
});}
http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#aggregate
ODM's
Mongoose
71
Mongoose
• Schema Validation
• Casting
• Business Logic Wrapper
• http://mongoosejs.com/
Simple Mongoose
var mongoose = require('mongoose'), assert =
require('assert')
var Schema = mongoose.Schema;
//define a schema
var userSchema = new Schema({ name: String, age:
Number})
//create static members
userSchema.statics.findByName = function( name, cb){
return this.find( {"name": name}, cb);
}
…
Simple Mongoose
…
//generate a model
var User = mongoose.model('User', userSchema);
//initiate the new user, validates the given arguments
var u1 = User({name:"Many Delgado", age:14});
//just save it
u1.save(function(err){
assert.equal(null, err);
});
74
Other Projects
Project Repository
MongoSkin https://github.com/kissjs/node-mongoskin
Mongolia https://github.com/masylum/mongolia
Mongojs https://github.com/mafintosh/mongojs
MongoSmash https://github.com/bengl/mongosmash
MEAN Stack
76
MEAN Stack
• MongoDB
• Express.js
• Angular JS
• Node.js
Express is a minimal and flexible Node.js web
application framework that provides a robust
set of features for web and mobile
applications.
AngularJS lets you extend HTML vocabulary
for your application. The resulting
environment is extraordinarily expressive,
readable, and quick to develop
Building your first app with MongoDB: Creating
a RESTAPI using the MEAN Stack
https://www.mongodb.com/blog/post/building-
your-first-application-mongodb-creating-rest-
api-using-mean-stack-part-1
Meteor
Meteor is a complete open source platform
for building web and mobile apps in pure
JavaScript.
82
Meteor
• Responsiveness
• Reactiveness
• Multiplatform
• Unified Package System
• Hot Deploys
https://www.meteor.com/try
METEOR: Build IOS andAndroidApps
that are a delight to use
http://www.mongodb.com/blog/post/meteor-
build-ios-and-android-apps-are-delight-use
Recap
85
What we talked about today…
• Node.js is a very productive language
– Our driver is highly adopted
– Updated
– Fully compatible
• CRUD Operations
– Insert, Update, Remove, Delete
• Write Concerns
– Flexible to write
• Read Preferences
– Flexible to read
• Aggregation Framework
– Analytics at your fingertips
86
Large Ecosystem
• Mongoose
• Mean Stack
• Meteor
• Many other projects
87
Where to next?
• Questions on the driver:
– https://groups.google.com/forum/#!forum/node-mongodb-native
• Issues:
– https://jira.mongodb.org/browse/NODE/?selectedTab=com.atlass
ian.jira.jira-projects-plugin:summary-panel
• Tutorial:
– http://mongodb.github.io/node-mongodb-native/2.0/
• Todays code:
– https://github.com/nleite/firstappnodejs
• Other:
– http://www.mongodb.com/norberto
http://www.mongodb.com/webinar/managing-
mission-critical-app-downtime
89
For More Information
Resource Location
Case Studies mongodb.com/customers
Presentations mongodb.com/presentations
Free Online Training education.mongodb.com
Webinars and Events mongodb.com/events
Documentation docs.mongodb.org
MongoDB Downloads mongodb.com/download
Additional Info info@mongodb.com
Blog blog.mongodb.com
90
Register now: mongodbworld.com
Use Code NorbertoLeite for additional 25% Off
*Come as a group of 3 or more – Save another 25%
http://cl.jroo.me/z3/v/D/C/e/a.baa-Too-many-bicycles-on-the-van.jpg
Questions?
@nleite
norberto@mongodb.com
http://www.mongodb.com/norberto
Webinar: Building Your First App in Node.js

More Related Content

What's hot

Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...BradNeuberg
 
Aggregation Framework in MongoDB Overview Part-1
Aggregation Framework in MongoDB Overview Part-1Aggregation Framework in MongoDB Overview Part-1
Aggregation Framework in MongoDB Overview Part-1Anuj Jain
 
MongoDB Aggregation Framework
MongoDB Aggregation FrameworkMongoDB Aggregation Framework
MongoDB Aggregation FrameworkCaserta
 
Aggregation Framework MongoDB Days Munich
Aggregation Framework MongoDB Days MunichAggregation Framework MongoDB Days Munich
Aggregation Framework MongoDB Days MunichNorberto Leite
 
Integrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteIntegrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteBram Vogelaar
 
NoSQL meets Microservices - Michael Hackstein
NoSQL meets Microservices - Michael HacksteinNoSQL meets Microservices - Michael Hackstein
NoSQL meets Microservices - Michael Hacksteindistributed matters
 
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015NoSQLmatters
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance TuningPuneet Behl
 
MongoDB World 2016 : Advanced Aggregation
MongoDB World 2016 : Advanced AggregationMongoDB World 2016 : Advanced Aggregation
MongoDB World 2016 : Advanced AggregationJoe Drumgoole
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Masahiro Nagano
 
Operational Intelligence with MongoDB Webinar
Operational Intelligence with MongoDB WebinarOperational Intelligence with MongoDB Webinar
Operational Intelligence with MongoDB WebinarMongoDB
 
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB
 
Joins and Other Aggregation Enhancements Coming in MongoDB 3.2
Joins and Other Aggregation Enhancements Coming in MongoDB 3.2Joins and Other Aggregation Enhancements Coming in MongoDB 3.2
Joins and Other Aggregation Enhancements Coming in MongoDB 3.2MongoDB
 
MongoDB World 2016: Deciphering .explain() Output
MongoDB World 2016: Deciphering .explain() OutputMongoDB World 2016: Deciphering .explain() Output
MongoDB World 2016: Deciphering .explain() OutputMongoDB
 
Inside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source DatabaseInside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source DatabaseMike Dirolf
 
Ken 20150306 心得分享
Ken 20150306 心得分享Ken 20150306 心得分享
Ken 20150306 心得分享LearningTech
 
FwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.jsFwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.jsTimur Shemsedinov
 
EWD 3 Training Course Part 21: Persistent JavaScript Objects
EWD 3 Training Course Part 21: Persistent JavaScript ObjectsEWD 3 Training Course Part 21: Persistent JavaScript Objects
EWD 3 Training Course Part 21: Persistent JavaScript ObjectsRob Tweed
 
Aggregation in MongoDB
Aggregation in MongoDBAggregation in MongoDB
Aggregation in MongoDBKishor Parkhe
 

What's hot (20)

Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
 
Aggregation Framework in MongoDB Overview Part-1
Aggregation Framework in MongoDB Overview Part-1Aggregation Framework in MongoDB Overview Part-1
Aggregation Framework in MongoDB Overview Part-1
 
MongoDB Aggregation Framework
MongoDB Aggregation FrameworkMongoDB Aggregation Framework
MongoDB Aggregation Framework
 
Aggregation Framework MongoDB Days Munich
Aggregation Framework MongoDB Days MunichAggregation Framework MongoDB Days Munich
Aggregation Framework MongoDB Days Munich
 
Integrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suiteIntegrating icinga2 and the HashiCorp suite
Integrating icinga2 and the HashiCorp suite
 
NoSQL meets Microservices - Michael Hackstein
NoSQL meets Microservices - Michael HacksteinNoSQL meets Microservices - Michael Hackstein
NoSQL meets Microservices - Michael Hackstein
 
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
 
MongoDB Performance Tuning
MongoDB Performance TuningMongoDB Performance Tuning
MongoDB Performance Tuning
 
Indexing
IndexingIndexing
Indexing
 
MongoDB World 2016 : Advanced Aggregation
MongoDB World 2016 : Advanced AggregationMongoDB World 2016 : Advanced Aggregation
MongoDB World 2016 : Advanced Aggregation
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015
 
Operational Intelligence with MongoDB Webinar
Operational Intelligence with MongoDB WebinarOperational Intelligence with MongoDB Webinar
Operational Intelligence with MongoDB Webinar
 
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
 
Joins and Other Aggregation Enhancements Coming in MongoDB 3.2
Joins and Other Aggregation Enhancements Coming in MongoDB 3.2Joins and Other Aggregation Enhancements Coming in MongoDB 3.2
Joins and Other Aggregation Enhancements Coming in MongoDB 3.2
 
MongoDB World 2016: Deciphering .explain() Output
MongoDB World 2016: Deciphering .explain() OutputMongoDB World 2016: Deciphering .explain() Output
MongoDB World 2016: Deciphering .explain() Output
 
Inside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source DatabaseInside MongoDB: the Internals of an Open-Source Database
Inside MongoDB: the Internals of an Open-Source Database
 
Ken 20150306 心得分享
Ken 20150306 心得分享Ken 20150306 心得分享
Ken 20150306 心得分享
 
FwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.jsFwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.js
 
EWD 3 Training Course Part 21: Persistent JavaScript Objects
EWD 3 Training Course Part 21: Persistent JavaScript ObjectsEWD 3 Training Course Part 21: Persistent JavaScript Objects
EWD 3 Training Course Part 21: Persistent JavaScript Objects
 
Aggregation in MongoDB
Aggregation in MongoDBAggregation in MongoDB
Aggregation in MongoDB
 

Similar to Webinar: Building Your First App in Node.js

Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBMongoDB
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code維佋 唐
 
MeaNstack on Docker
MeaNstack on DockerMeaNstack on Docker
MeaNstack on DockerDaniel Ku
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppSmartLogic
 
How To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and ComposeHow To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and ComposeDocker, Inc.
 
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBChun-Kai Wang
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsasync_io
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...Jérôme Petazzoni
 
Rails Engine | Modular application
Rails Engine | Modular applicationRails Engine | Modular application
Rails Engine | Modular applicationmirrec
 
Introduction to MongoDB with PHP
Introduction to MongoDB with PHPIntroduction to MongoDB with PHP
Introduction to MongoDB with PHPfwso
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Cosimo Streppone
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBTobias Trelle
 
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 MongoDBMongoDB
 
Get expertise with mongo db
Get expertise with mongo dbGet expertise with mongo db
Get expertise with mongo dbAmit Thakkar
 
오픈 소스 프로그래밍 - NoSQL with Python
오픈 소스 프로그래밍 - NoSQL with Python오픈 소스 프로그래밍 - NoSQL with Python
오픈 소스 프로그래밍 - NoSQL with PythonIan Choi
 
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 MongoDBTobias Trelle
 

Similar to Webinar: Building Your First App in Node.js (20)

MongoDB and Node.js
MongoDB and Node.jsMongoDB and Node.js
MongoDB and Node.js
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
 
Rails with mongodb
Rails with mongodbRails with mongodb
Rails with mongodb
 
MeaNstack on Docker
MeaNstack on DockerMeaNstack on Docker
MeaNstack on Docker
 
Practical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails AppPractical Chef and Capistrano for Your Rails App
Practical Chef and Capistrano for Your Rails App
 
How To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and ComposeHow To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and Compose
 
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...
 
Rails Engine | Modular application
Rails Engine | Modular applicationRails Engine | Modular application
Rails Engine | Modular application
 
Introduction to MongoDB with PHP
Introduction to MongoDB with PHPIntroduction to MongoDB with PHP
Introduction to MongoDB with PHP
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
Mongodb
MongodbMongodb
Mongodb
 
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
 
Get expertise with mongo db
Get expertise with mongo dbGet expertise with mongo db
Get expertise with mongo db
 
오픈 소스 프로그래밍 - NoSQL with Python
오픈 소스 프로그래밍 - NoSQL with Python오픈 소스 프로그래밍 - NoSQL with Python
오픈 소스 프로그래밍 - NoSQL with Python
 
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
 

More from MongoDB

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump StartMongoDB
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB
 

More from MongoDB (20)

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
 

Recently uploaded

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 ModelDeepika Singh
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
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, ...apidays
 
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.pptxRustici Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
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.pdfOrbitshub
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
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.pdfsudhanshuwaghmare1
 
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 Ontologyjohnbeverley2021
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
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 DiscoveryTrustArc
 
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 REVIEWERMadyBayot
 
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 FMESafe Software
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

Recently uploaded (20)

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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
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, ...
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
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
 
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
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
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
 
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...
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Webinar: Building Your First App in Node.js

  • 1.
  • 2. MongoDB + Node.js Building first app with MongoDB and Node.js
  • 4. 4 Ola, I'm Norberto! Norberto Leite Technical Evangelist Madrid, Spain @nleite norberto@mongodb.com http://www.mongodb.com/norberto
  • 8. 8 Few reasons why Flexible Agile Web Language
  • 9. 9 MongoDB + Javascript • MongoDB Shell – JS interperter • MongoDB MapReduce – Runs on top of V8 – Map and Reduce functions are JS functions • Native support for Node.js – One of the most used Drivers out there! – https://www.npmjs.com/package/mongodb
  • 12. 12 2 Foundations • Events / Event Loop – Single Thread Applications – No threads – Events Emitter – Event Queue – Known Events • Streams – Read, Write, Both – Unix Pipes – We use it extensively!
  • 14. npm package $ npm install mongodb
  • 18. package.json file $ mkdir firstappnodejs $ cd firstappnodejs $ npm init
  • 19. package.json file $ mkdir firstappnodejs $ cd firstappnodejs $ npm init ... { "name": "firstappnodejs", "version": "0.0.1", "description": "Small demo webinar application", "main": "index.js", "scripts": { "test": "workitout" }, "repository": { "type": "git", "url": "git://github.com/nleite/firstappnodejs" }, "dependencies": { "mongodb": "~2.0" }, "keywords": [http://docs.mongodb.org/ecosystem/drivers/node-js/#compatibility "demo", "nodejs", "mongodb" ], "author": "Norberto Leite", "license": "Apache 2.0", "bugs": { "url": "https://github.com/nleite/firstappnodejs/issues" }, "homepage": "https://github.com/nleite/firstappnodejs"
  • 20. package.json file $ mkdir firstappnodejs $ cd firstappnodejs $ npm init ... { "name": "firstappnodejs", "version": "0.0.1", "description": "Small demo webinar application", "main": "index.js", "scripts": { "test": "workitout" }, "repository": { "type": "git", "url": "git://github.com/nleite/firstappnodejs" }, "dependencies": { "mongodb": "~2.0" }, "keywords": [ "demo", "nodejs", "mongodb" ], "author": "Norberto Leite", "license": "Apache 2.0", "bugs": { "url": "https://github.com/nleite/firstappnodejs/issues" }, "homepage": "https://github.com/nleite/firstappnodejs"
  • 21. Install our new firstappnodejs app! $ npm install > kerberos@0.0.10 install … … > bson@0.3.1 install > mongodb@2.0.28 node_modules/mongodb ├── readable-stream@1.0.31 (isarray@0.0.1, inherits@2.0.1, string_decoder@0.10.31, core-util-is@1.0.1) └── mongodb-core@1.1.25 (kerberos@0.0.10, bson@0.3.1) firstappnodejs/ $ ls node_modules package.json
  • 23. boot up MongoDB Server $ mkdir ~/firstappdb $ mongod --dbpath ~/firstappdb
  • 24. boot up MongoDB Server $ mkdir ~/firstappdb $ mongod --dbpath ~/firstappdb --auth --keyfile ~/n.pem https://www.mongodb.com/products/mongodb-enterprise-advanced
  • 25. boot up MongoDB Server $ mkdir ~/firstappdb $ mongod --dbpath ~/firstappdb --auth --keyfile ~/n.pem https://www.mongodb.com/products/mongodb-enterprise-advanced
  • 26. var MongoClient = require('mongodb').MongoClient, assert = require('assert'); Connect
  • 27. var MongoClient = require('mongodb').MongoClient, assert = require('assert'); //connection uri var uri = "mongodb://localhost:27017/firstapp" Connect
  • 28. var MongoClient = require('mongodb').MongoClient, assert = require('assert'); //connection uri var uri = "mongodb://localhost:27017/firstapp" //connect to MongoDB MongoClient.connect(uri, function(err, db){ assert.equal(null, err); console.log("Connected correctly to server"); db.close(); }); Connect
  • 29. 29 Connection Pooling • No traditional Pooling mechanism – Single thread process • Sockets to pipeline operations • Failover – Buffering up operations – bufferMaxEntries – numberOfRetries – retryMiliSeconds http://mongodb.github.io/node-mongodb-native/2.0/api/Db.html
  • 30. CRUD
  • 31. var insertDocuments = function(db, cb){ //we don't need to explicitly create a collection var collection = db.collection('myCollection'); collection.insertMany([ {"mongodb": "is just awesome"}, {"nodejs": "so awesome"} ], function(err, result){ assert.equal(null, err); //inserted 2 documents assert.equal(2, result.insertedCount); //invoke callback cb(result); }); } Insert http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert
  • 32. var insertDocuments = function(db, cb){ //we don't need to explicitly create a collection var collection = db.collection('myCollection'); collection.insertMany([ {"mongodb": "is just awesome"}, {"nodejs": "so awesome"} ], function(err, result){ assert.equal(null, err); //inserted 2 documents assert.equal(2, result.insertedCount); //invoke callback cb(result); }); } Insert http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert
  • 33. var insertDocuments = function(db, cb){ //we don't need to explicitly create a collection var collection = db.collection('myCollection'); collection.insertMany([ {"mongodb": "is just awesome"}, {"nodejs": "so awesome"} ], function(err, result){ assert.equal(null, err); //inserted 2 documents assert.equal(2, result.insertedCount); //invoke callback cb(result); }); } Insert http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert
  • 34. var insertDocuments = function(db, cb){ //we don't need to explicitly create a collection var collection = db.collection('myCollection'); collection.insertMany([ {"mongodb": "is just awesome"}, {"nodejs": "so awesome"} ], function(err, result){ assert.equal(null, err); //inserted 2 documents assert.equal(2, result.insertedCount); //invoke callback cb(result); }); } Insert http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert
  • 35. MongoClient.connect(uri, function(err, db) { assert.equal(null, err); console.log("Sweet! Talking to Server"); insertDocuments(db, function() { db.close(); }); }); Insert http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert
  • 36. MongoClient.connect(uri, function(err, db) { assert.equal(null, err); console.log("Sweet! Talking to Server"); insertDocuments(db, function() { db.close(); }); }); Insert http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert
  • 37. var updateDocument = function(db, cb){ var collection = db.collection("myCollection"); collection.updateOne( {"mongodb": "is just awesome"}, {$set: {"users": ["nleite"]}}, function( err, result){ assert.equal(null, err); assert.equal(1, result.modifiedCount); console.log("Cool, just updated"); cb(result); }); } Update http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update
  • 38. var updateDocument = function(db, cb){ var collection = db.collection("myCollection"); collection.updateOne( {"mongodb": "is just awesome"}, {$set: {"users": ["nleite"]}}, function( err, result){ assert.equal(null, err); assert.equal(1, result.modifiedCount); console.log("Cool, just updated"); cb(result); }); } Update http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update
  • 39. var updateDocument = function(db, cb){ var collection = db.collection("myCollection"); collection.updateOne( {"mongodb": "is just awesome"}, {$set: {"users": ["nleite"]}}, function( err, result){ assert.equal(null, err); assert.equal(1, result.modifiedCount); console.log("Cool, just updated"); cb(result); }); } Update http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update
  • 40. var updateDocument = function(db, cb){ var collection = db.collection("myCollection"); collection.updateOne( {"mongodb": "is just awesome"}, {$set: {"users": ["nleite"]}}, function( err, result){ assert.equal(null, err); assert.equal(1, result.modifiedCount); console.log("Cool, just updated"); cb(result); }); } Update http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update
  • 41. MongoClient.connect(uri, function(err, db) { assert.equal(null, err); console.log("Ok, I can now update!"); updateDocuments(db, function() { db.close(); }); }); Update http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update
  • 42. Remove var removeDocument = function(db, cb){ var collection = db.collection("myCollection"); collection.deleteOne( {"users": "nleite"}, function( err, result){ assert.equal(null, err); assert.equal(1, result.deletedCount); console.log("purged the @nleite contaminated data!"); cb(result); }); } http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#remove
  • 43. Remove var removeDocument = function(db, cb){ var collection = db.collection("myCollection"); collection.deleteOne( {"users": "nleite"}, function( err, result){ assert.equal(null, err); assert.equal(1, result.deletedCount); console.log("purged the @nleite contaminated data!"); cb(result); }); } http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#remove
  • 44. Remove var removeDocument = function(db, cb){ var collection = db.collection("myCollection"); collection.deleteOne( {"users": "nleite"}, function( err, result){ assert.equal(null, err); assert.equal(1, result.deletedCount); console.log("purged the @nleite contaminated data!"); cb(result); }); } http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#remove
  • 45. Remove MongoClient.connect(uri, function(err, db) { assert.equal(null, err); console.log("Ok, I can now delete!"); removeDocuments(db, function() { db.close(); }); }); http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#remove
  • 46. Find var findAllDocuments = function(db, cb){ var collection = db.collection('myDocuments'); //or collection.find() collection.find({}).toArray(function(err, docs){ assert.equal(err, null); assert.equal(1, docs.length); console.log("Gotcha! found "+ docs.length); console.dir(docs); cb(docs); }); } http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#find
  • 47. Find var findAllDocuments = function(db, cb){ var collection = db.collection('myDocuments'); //or collection.find() collection.find({}).toArray(function(err, docs){ assert.equal(err, null); assert.equal(1, docs.length); console.log("Gotcha! found "+ docs.length); console.dir(docs); cb(docs); }); } http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#find
  • 48. Find var findAllDocuments = function(db, cb){ var collection = db.collection('myDocuments'); //or collection.find() collection.find({}).toArray(function(err, docs){ assert.equal(err, null); assert.equal(1, docs.length); console.log("Gotcha! found "+ docs.length); console.dir(docs); cb(docs); }); } http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#find
  • 51. Different Schemas var insertDifferentShapes = function(db, cb){ var doc1 = {"name": "Norberto", "talks": [ {"nodejs":10}, {"java":15}, "python":11]}; var doc2 = {"name": "Bryan", "webinars": 30}; var coll = db.collection("content") coll.insertMany( [doc1, doc2], function(err, result){ assert.equal(err, null); assert.equal(2, result.insertedCount); console.log("Sweet, inserted "+ result.insertedCount); cb(result); }); } http://docs.mongodb.org/manual/data-modeling/
  • 52. Different Schemas var insertDifferentShapes = function(db, cb){ var doc1 = {"name": "Norberto", "talks": [ {"nodejs":10}, {"java":15}, "python":11]}; var doc2 = {"name": "Bryan", "webinars": 30}; var coll = db.collection("content") coll.insertMany( [doc1, doc2], function(err, result){ assert.equal(err, null); assert.equal(2, result.insertedCount); console.log("Sweet, inserted "+ result.insertedCount); cb(result); }); } http://docs.mongodb.org/manual/data-modeling/
  • 57. Different WriteConcerns var insertSuperImportant = function(db, cb){ var customer = {"name": "Manny Delgado", "age": 14}; var coll = db.collection("customers"); var writeConcern = {"w": "majority"}; col.insertOne( customer, writeConcern, function(err, result){ assert.equal(err, null); assert.equal(1, result.insertedCount); console.log("Inserted super important record"); cb(result); }); } http://mongodb.github.io/node-mongodb-native/2.0/api/WriteConcernError.html
  • 58. Different WriteConcerns var insertSuperImportant = function(db, cb){ var customer = {"name": "Manny Delgado", "age": 14}; var coll = db.collection("customers"); var writeConcern = {"w": "majority"}; col.insertOne( customer, writeConcern, function(err, result){ assert.equal(err, null); assert.equal(1, result.insertedCount); console.log("Inserted super important record"); cb(result); }); } http://mongodb.github.io/node-mongodb-native/2.0/api/WriteConcernError.html
  • 60. 60 Read Preference • Read from Primary (default) ReadPreference.PRIMARY • Read from Primary Preferably ReadPreference.PRIMARY_PREFERRED • Read from Secondary ReadPreference.SECONDARY • Read from Secondary Preferably ReadPreference.SECONDARY_PREFERRED • Read from Nearest Node ReadPreference.NEAREST http://mongodb.github.io/node-mongodb-native/2.0/api/ReadPreference.html
  • 61. Read From Nearest var readNearestWaterMelonColor = function(db, cb){ var rp = ReadPreference.NEAREST; var coll = db.collection("products", {ReadPreference:rp}); var query = {"color": "water melon green"}; collection.find(query).toArray(function(err, docs){ assert.equal(err, null); assert.equal(1, docs.length); console.log("So many products: "+ docs.length); console.dir(docs); cb(docs); }); } http://mongodb.github.io/node-mongodb-native/2.0/api/ReadPreference.html
  • 62. Read From Nearest var readNearestWaterMelonColor = function(db, cb){ var rp = ReadPreference.NEAREST; var coll = db.collection("products", {ReadPreference:rp}); var query = {"color": "water melon green"}; collection.find(query).toArray(function(err, docs){ assert.equal(err, null); assert.equal(1, docs.length); console.log("So many products: "+ docs.length); console.dir(docs); cb(docs); }); } http://mongodb.github.io/node-mongodb-native/2.0/api/ReadPreference.html
  • 63. Read From Nearest var readNearestWaterMelonColor = function(db, cb){ var rp = ReadPreference.NEAREST; var coll = db.collection("products", {readPreference:rp}); var query = {"color": "water melon green"}; collection.find(query).toArray(function(err, docs){ assert.equal(err, null); assert.equal(1, docs.length); console.log("So many products: "+ docs.length); console.dir(docs); cb(docs); }); } http://mongodb.github.io/node-mongodb-native/2.0/api/ReadPreference.html
  • 65. Aggregation var aggregateAvgAgeGender = function( db, cb){ //{age:XX, name:"user name", gender: "M/F"} var pipeline = [ {$group: { "_id": "$gender", avg_age: {$avg: "$age"}}}, ]; var coll = db.collection("users"); var cursor = coll.aggregate(pipeline); cursor.forEach( function(x){ console.log("Gender " + x._id + " age average " + x.avg_age) }, function(x) { cb(cursor); }); } http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#aggregate
  • 66. Aggregation var aggregateAvgAgeGender = function( db, cb){ //{age:XX, name:"user name", gender: "M/F"} var pipeline = [ {$group: { "_id": "$gender", avg_age: {$avg: "$age"}}}, ]; var coll = db.collection("users"); var cursor = coll.aggregate(pipeline); cursor.forEach( function(x){ console.log("Gender " + x._id + " age average " + x.avg_age) }, function(x) { cb(cursor); }); } http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#aggregate
  • 67. Aggregation var aggregateAvgAgeGender = function( db, cb){ //{age:XX, name:"user name", gender: "M/F"} var pipeline = [ {$group: { "_id": "$gender", avg_age: {$avg: "$age"}}}, ]; var coll = db.collection("users"); var cursor = coll.aggregate(pipeline); cursor.forEach( function(x){ console.log("Gender " + x._id + " age average " + x.avg_age) }, function(x) { cb(cursor); }); } http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#aggregate
  • 68. Aggregation var aggregateAvgAgeGender = function( db, cb){ //{age:XX, name:"user name", gender: "M/F"} var pipeline = [ {$match:{"age": $gt: 18}}, {$group: { "_id": "$gender", avg_age: {$avg: "$age"}}}, {$project:{"ID": "$_id", "average": "$avg_age" }} ]; var cursor = coll.aggregate(pipeline); var coll = db.collection("users"); cursor.forEach( function(x){ console.log("Gender " + x._id + " age average " + x.avg_age) }, function(x) { cb(cursor); });} http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#aggregate
  • 69. ODM's
  • 71. 71 Mongoose • Schema Validation • Casting • Business Logic Wrapper • http://mongoosejs.com/
  • 72. Simple Mongoose var mongoose = require('mongoose'), assert = require('assert') var Schema = mongoose.Schema; //define a schema var userSchema = new Schema({ name: String, age: Number}) //create static members userSchema.statics.findByName = function( name, cb){ return this.find( {"name": name}, cb); } …
  • 73. Simple Mongoose … //generate a model var User = mongoose.model('User', userSchema); //initiate the new user, validates the given arguments var u1 = User({name:"Many Delgado", age:14}); //just save it u1.save(function(err){ assert.equal(null, err); });
  • 74. 74 Other Projects Project Repository MongoSkin https://github.com/kissjs/node-mongoskin Mongolia https://github.com/masylum/mongolia Mongojs https://github.com/mafintosh/mongojs MongoSmash https://github.com/bengl/mongosmash
  • 76. 76 MEAN Stack • MongoDB • Express.js • Angular JS • Node.js
  • 77. Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
  • 78. AngularJS lets you extend HTML vocabulary for your application. The resulting environment is extraordinarily expressive, readable, and quick to develop
  • 79. Building your first app with MongoDB: Creating a RESTAPI using the MEAN Stack https://www.mongodb.com/blog/post/building- your-first-application-mongodb-creating-rest- api-using-mean-stack-part-1
  • 81. Meteor is a complete open source platform for building web and mobile apps in pure JavaScript.
  • 82. 82 Meteor • Responsiveness • Reactiveness • Multiplatform • Unified Package System • Hot Deploys https://www.meteor.com/try
  • 83. METEOR: Build IOS andAndroidApps that are a delight to use http://www.mongodb.com/blog/post/meteor- build-ios-and-android-apps-are-delight-use
  • 84. Recap
  • 85. 85 What we talked about today… • Node.js is a very productive language – Our driver is highly adopted – Updated – Fully compatible • CRUD Operations – Insert, Update, Remove, Delete • Write Concerns – Flexible to write • Read Preferences – Flexible to read • Aggregation Framework – Analytics at your fingertips
  • 86. 86 Large Ecosystem • Mongoose • Mean Stack • Meteor • Many other projects
  • 87. 87 Where to next? • Questions on the driver: – https://groups.google.com/forum/#!forum/node-mongodb-native • Issues: – https://jira.mongodb.org/browse/NODE/?selectedTab=com.atlass ian.jira.jira-projects-plugin:summary-panel • Tutorial: – http://mongodb.github.io/node-mongodb-native/2.0/ • Todays code: – https://github.com/nleite/firstappnodejs • Other: – http://www.mongodb.com/norberto
  • 89. 89 For More Information Resource Location Case Studies mongodb.com/customers Presentations mongodb.com/presentations Free Online Training education.mongodb.com Webinars and Events mongodb.com/events Documentation docs.mongodb.org MongoDB Downloads mongodb.com/download Additional Info info@mongodb.com Blog blog.mongodb.com
  • 90. 90 Register now: mongodbworld.com Use Code NorbertoLeite for additional 25% Off *Come as a group of 3 or more – Save another 25%

Editor's Notes

  1. - Change this hear to a better edited one
  2. - Change this hear to a better edited one
  3. Basic Driver installation for Node.js is to follow npm repository
  4. We should create a project folder Initialized it with NPM Add the dependency to MongoDB lattes version the file should resemble something very similar to the shown example
  5. We should create a project folder Initialized it with NPM Add the dependency to MongoDB lattes version the file should resemble something very similar to the shown example
  6. - But do not forget to edit the dependencies accordingly!
  7. Raises a server listening on port 27017 by default and pointing to ~/firstappdb
  8. Do not forget that mongodb is ready for the authentication + authorization + auditing
  9. Do not forget that mongodb is ready for the authentication + authorization + auditing
  10. Pooling: there are no traditional concept of connection pools since this is a single threaded process. We use sockets to pupeline the commands to MongoDB. Failover consists on buffering up the commands till the servers are available These can be controlled by bufferMaxEntries, numberOfRetries and retryMiliSeconds
  11. - Define the query to match the wanted documents
  12. $set operator that will perform the change In this case will produce the set of new array field
  13. Verify that the operation occurred without errors and matches the expected end result In this case 1 updated document
  14. - Performs a multikey query operation
  15. - The only variation on this case is that we are not going to handle the results object but the cursor returned by the query method
  16. Change this slid
  17. - Also mention the fact that we can specify the way we want to read from using replica tags
  18. - Define the Nearest read preference
  19. Set it at collection level We can set this at connection, db, collection and instruction level
  20. don't forget this is a pipeline of operations We can build it in a programmatically shape to adjust to what we need to extract
  21. Mongojs – simulates the mongoshell from nodejs Mongoskin – layer for mongo-native nodejs driver Mongolia – lightweight ODM