SlideShare una empresa de Scribd logo
1 de 55
BuildingApps w/ MEAN Stack
Get ready to be MEAN!
4
Topics
Backend Implementation
Schema Design
MEAN Stack Benefits
Best Practices
5
Building and MEAN app
• MongoDB is great for storing web/mobile app data
• So let’s build a REST API using Node.js!
– learn a bit about overall MEAN Stack libraries
–learn a few MongoDB schema design principles
6
MEAN Stack
7
Overview
• Part 1: Shopping Cart Application
– Search for products
– Add them to your cart
– Check out with Stripe
• Part 2: Using the Mongoose ODM
• Part 3: Schema Design
• Part 4: Building an API with the Express framework
• Part 5: Front End w/ Angular
Part 1: Let's Build a Shopping Cart
9
Search Products
10
Add Product to Shopping Cart
11
Check out Shopping Cart
App Structure
"Bad programmers worry about the code. Good
programmers worry about data structures and their
relationships." - Linus Torvalds
3 schemas for 3 collections
Products Categories Users
16
Schema Relationships
Entity A Entity B
1 1
Document A
Document B
Entity A Entity B
1 N
Document A
Array of
B's
Entity A Entity B
1 NNNN
Entity A Entity B
N N
Document A Document B
17
Schema Relationships
Products Categories
N 1
Users Shopping Cart
1 N
Shopping Cart Products
N N
18
Schema Relationships
• Product belongs to one or more categories
• Users can have multiple products in their cart
• Representing relationships in MongoDB is tricky (
different from doing a traditional RDBMS system – based
on the usage patterns of data)
• But that’s what mongoose HELPS A LOT!
Part 2: Using the Mongoose ODM
20
Mongoose
Object Document
Mapper
Async Schema
Validation
http://mongoosejs.com/
21
Your first Mongoose Schema!
var mongoose = require('mongoose');
module.exports = new mongoose.Schema(
{
name:{
type: String,
required: true,
}
email:{
type: String,
required: true,
match: /.+@.+..+/,
lowercase: true
},
loggedInCounter:{
type: Number,
default: 0,
}
});
"require" mongoose
Define fields
Field types, validation rules
and attributes
Document Validation
Available on 3.2.0-RC2
https://jira.mongodb.org/browse/SERVER-18227
http://www.eliothorowitz.com/blog/2015/09/11/document-validation-and-what-dynamic-
schema-means/
23
Using your schemavar mongoose = require('mongoose');
var schema = require('./schemas/user');
mongoose.connect('mongodb://localhost:27017/meancart');
var User = mongoose.Model('User', schema, 'users');
var newuser = new User({
name: 'Jose Mourinho',
email: 'specialone@chelseafc.co.uk',
});
newuser.save( function(error){
if (error){
console.log(error);
process.exit(1);
}
User.find({email: 'specialone@chelseafc.co.uk'}, function(error, docs){
if(error){
console.log(error);
process.exit(1);
}
console.log(require('util').inspect(docs));
process.exit(1);
});
} );
Tell mongoose where to
connect
Create model using given
schema and initialize object
Save user and load it from
MongoDB
24
Takeaways
• Mongoose provides several neat features
– MVC model
–Default values
– Schema validation
–Declarative schema design
Part 3: Schema Design
26
Schema Design
• 3 schemas
– Product
–Category
– User
• Define Mongoose schemas
• Focus on a couple of key design principles
27
Category Schema
var mongoose = require('mongoose');
var categorySchema = {
_id: { type: String},
parent: {
type: String,
ref: 'Category',
},
ancestors: [{
type: String,
ref: 'Category'
}]
};
module.exports = new mongoose.Schema(categorySchema);
module.exports.categorySchema = categorySchema;
Inner sub-document
array
Self "join" reference
http://mongoosejs.com/docs/populate.html
$lookup
Go and try it out w/ 3.2.0-RC2:
https://jira.mongodb.org/browse/SERVER-19095
https://www.mongodb.com/blog/post/thoughts-on-new-feature-lookup
29
Product Schema
var mongoose = require('mongoose');
var Category = require('./category');
var productSchema = {
name: { type: String, required: true },
pictures: [{ type: String, match: /^http:///i}],
price: {
amount: { type: Number, required: true},
currency: {
type: String,
enum: ['USD', 'EUR', 'GBP'],
required: true
},
},
category: Category.categorySchema
};
module.exports = new mongoose.Schema(productSchema);
module.exports.productSchema = productSchema;
Category Schema
30
Creating a Productvar mongoose = require('mongoose');
var productSchema = require('./product');
var Product = mongoose.model('Product', productSchema);
var p = new Product({
name: 'chelsea scarf blue',
price: {
amount: 12.97,
currency: 'GBP',
},
category:{
name:'scarfs'
}
});
p.name = 2;
console.log(p.name); //2
console.log(p.$isValid('name')); // true
p.price.amount = 'Not a number';
console.log(p.$isValid('price.amount')); //false
p.validate(function(err){
// CastError because `price.amount` couldn't be
// casted to a number
console.log(err);
});
Cast Validation
Invalid Cast
Validation Method
31
Category Schema Queries
• What categories are descent of "wearables" ?
• What categories are children of "accessories"?
• What categories are ancestors of "scarf"?
db.category.find( {'ancestors': 'wearables'})
{"_id": "wearables", "parent": "accessories", "ancestors": ["accessories","wearables"]}
{"_id": "scarfs", "parent": "wearables", "ancestors": ["accessories", "wearables", "scarfs"]}
db.category.find( {'parent': "accessories"})
{"_id": "wearables", "parent": "accessories", "ancestors": ["accessories","wearables"]}
db.category.find( {'_id': 'scarf'}, {"_id":0, "ancestors":1})
{"ancestors": ["accessories","wearables"]}
32
… make sure that:
• Queries should be simple!
• Strive for minimal data transformation by server
– Store what you query for
– How you use data defines your schema
• Aggregation Framework can complement complex queries but
– are heavy
– required resources
33
User Schemavar mongoose = require('mongoose');
var userSchema = {
profile: {
username: {
type: String,
required: true;
lowercase: true;
},
picture:{
type: String,
required: true,
match: /^http:///i,
},
},
data:{
cart:[{
product: {
type: mongoose.Schema.Types.ObjectId
},
quantity:{
type: Number,
defalt: 1,
min: 1
}
}]
}
};
module.exports = new mongoose.Schema(userSchema);
module.exports.userSchema = userSchema;
Embedded Cart Entity
Watch out for unbounded
arrays!
34
Cardinality Matters
• Product and user = many-to-many relationship
• User won't have 1000s of products in a cart
35
Cardinality Matters
• Product and user = many-to-many relationship
• User won't have 1000s of products in a cart
• Embedded array to represent that relationship
Shopping Cart Products
N N
36
Linking vs. Embedding
• Embedding
–Great for read performance
–Heavier writes
–Great for many-to-one when many is known!
• Linking
–Allows more Flexibility
–Extra work on read workloads
–Simpler writes
Part 4: Express.js
38
Express JS
Popular Node.js web framework
Simple, pluggable and fast
Great for build REST APIs
http://expressjs.com/
Your First ExpressApp
var express = require('express');
var app = express();
app.get('/products', function(req, res){
var limit = 10;
Product.find().limit(10).populate('category').
exec( function(err, docs){
if(err){
console.log('something is wrong: '+err.toString());
return res.status(status.INTERNAL_SERVER_ERROR).
json({error: err.toString()});
}
res.json({products: docs});
});
});
//start listening
app.listen(3000);
console.log("super REST app running");
Initiate app objects
Define route and method
Use Model to execute
database calls
40
FeelingAwesome?
41
Structure your REST API
var bodyParser = require('body-parser');
var express = require('express');
var app = express();
//body parser for json payloads
app.use(bodyParser.json());
//api version
app.use('/api/v1', require('./api');
//start listening
app.listen(3000);
console.log("super REST app running");
Define a separate module for
your version implementation
Structure your REST API
var express = require('express');
var status = require('http-status');
var mongoose = require('mongoose');
var productSchema = require('./schemas/product');
mongoose.connect('mongodb://localhost/test');
var Product = mongoose.model('Product', productSchema);
var api = express.Router();
api.get('/products', function(req, res){
var limit = 10;
var items = Product.find().limit(10).
populate('category').
exec( function(err, docs){
if(err){
console.log('something went wrong: '+err.toString());
return res.status(status.INTERNAL_SERVER_ERROR).
json({error: err.toString()});
}
res.json({products: docs});
});
});
module.exports = api;
Express Router object
Define route and method
43
GET /category/parent/:id
function errorHandler(res, err){
console.log('something went wrong: '+err.toString());
return res.status(status.INTERNAL_SERVER_ERROR).
json({error: err.toString()});
}
api.get('/products', function(req, res){ ... });
api.get('/category/parent/:id'), function(req, res){
var query = { parent: req.params.id};
var sort = {_id: -1};
Category.find(query).sort(sort).exec(function(err, docs){
if (err){
return errorHandler(res, err);
}
res.json({categories: docs});
});
});
Define route
Handle params and create
queries
44
Adding Products to User's Cart
api.put('/me/cart', function(req, res){
try{
var cart = req.body.cart;
}catch(e){
return errorHandler(res, error);
}
req.user.data.cart = cart;
req.user.save(function(err, user){
if(err){
return errorHandler(res, err);
}
return res.json({user: user});
});
});
Overwrite user's cart
Let mongoose handle
validation and casting of data
Mongoose lets you be lazy
Access control using subdocuments
var userSchema = {
profile: {...},
data:{
oauth: {type:String, required: true},
cart:[{
product: {
type: mongoose.Schema.Types.ObjectId
},
quantity:{type: Number, defalt: 1,min: 1
}
}]
}
};
45
Takeaways
• Express REST API on top of Mongoose
– Access control
–Business logic
– Decoupling database logic and access
Part 5: Angular.js
47
AngularJS
Front End Library
Extensible
Client Side MVC
https://angularjs.org/
Front End Server
var express = require('express');
var app = express();
app.use(express.static('front'));
app.get('/', function(req, res){
//load html page and let angular do all the wiring
res.sendfile('./front/index.html');
});
var server = app.listen(8080, function () {
var host = server.address().address;
var port = server.address().port;
console.log('Front end listening at http://%s:%s', host, port);
});
Using expressjs
Self "join" reference
index.html
<!doctype html>
<html lang="en" ng-app="meancart" ng-controller="listController">
<head>
<meta charset="utf-8">
<title>{{title}}</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/angular.min.js"></script>
<script src="js/controllers.js"></script>
</head>
App and Controller
Angular Controllers
const RESTSERVER = "http://localhost:3000";
var app = angular.module('meancart', []);
app.controller('listController', function($scope, $http){
$http.get(RESTSERVER+"/api/v1/products").success( function( response ){
$scope.title= "MEAN Cart!";
$scope.name= "List of Products";
$scope.list = response._items;
});
} );
Backend REST server
call
Templates
<!--index.html-->
<div class="col-md-10">
<div ng-include="'/templates/list.html'"></div>
</div>
<!--list.html-->
<br>
<ul class="media-list">
<li ng-repeat="item in list|filter:query" class="media">
<div ng-include="'templates/item.html'"></div>
</li>
</ul>
<!--item.html
<a class="pull-left" href="{{item.url}}">
<img class="img-responsive" src="{{item.img}}">
</a>
<div class="media-body">
<h4 class="media-heading">{{item.name}}</h4>
</div>
Bonus: Stripe checkout
Checkout w/ Stripe
Stripe = require('stripe');
api.post('/checkout', function(req, res){
if(!req.user){...}
req.user.populate(
{path: 'data.cart.product', model:'Product'},
function(err, user){
var totalCostGBP = 0;
_.each(user.data.cart, function(item){
totalCostGBP += item.product.amount * item.quantity;
});
Stripe.charges.create({
// Stripe requires the price in cents
amount: Math.ceil(totalCostGBP*100),
currency: 'gbp',
source: req.body.stripeToken,
description: 'Thank you for your money'
}, function(err, charge){...} );
});
});
Populate the user
object
Import Stripe module and
create a charge
Takeaways
55
MEAN Stack
• Flexible Stack
• Features, features, features
–Lots of libraries available
• Strong community support
ps – runs on the best database in the world!!!
56
Edx MEAN Stack Online Course
https://www.edx.org/course/introduction-mongodb-using-mean-stack-mongodbx-m101x
Obrigado!
Norberto Leite
Technical Evangelist
norberto@mongodb.com
@nleite

Más contenido relacionado

La actualidad más candente

MongoDB World 2019: Fast Machine Learning Development with MongoDB
MongoDB World 2019: Fast Machine Learning Development with MongoDBMongoDB World 2019: Fast Machine Learning Development with MongoDB
MongoDB World 2019: Fast Machine Learning Development with MongoDBMongoDB
 
Full stack development tools &amp; technologies
Full stack development tools &amp; technologiesFull stack development tools &amp; technologies
Full stack development tools &amp; technologieskumar satyam
 
Grokking #9: Building a real-time and offline editing service with Couchbase
Grokking #9: Building a real-time and offline editing service with CouchbaseGrokking #9: Building a real-time and offline editing service with Couchbase
Grokking #9: Building a real-time and offline editing service with CouchbaseOliver N
 
Introduction of ASP.NET MVC and AngularJS
Introduction of ASP.NET MVC and AngularJSIntroduction of ASP.NET MVC and AngularJS
Introduction of ASP.NET MVC and AngularJSMohamed Elkhodary
 
Project Dpilot Documentation
Project Dpilot DocumentationProject Dpilot Documentation
Project Dpilot DocumentationDeepAnshu Sharma
 
Valentine with Angular js - Introduction
Valentine with Angular js - IntroductionValentine with Angular js - Introduction
Valentine with Angular js - IntroductionSenthil Kumar
 
React.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UIReact.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UIMarcin Grzywaczewski
 
Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6Noam Kfir
 
Jasmine - A BDD test framework for JavaScript
Jasmine - A BDD test framework for JavaScriptJasmine - A BDD test framework for JavaScript
Jasmine - A BDD test framework for JavaScriptSumanth krishna
 
Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC Naresh Chintalcheru
 
Asp.net mvc 5 course module 1 overview
Asp.net mvc 5 course   module 1 overviewAsp.net mvc 5 course   module 1 overview
Asp.net mvc 5 course module 1 overviewSergey Seletsky
 
The fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactThe fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactOliver N
 
Combining react with node js to develop successful full stack web applications
Combining react with node js to develop successful full stack web applicationsCombining react with node js to develop successful full stack web applications
Combining react with node js to develop successful full stack web applicationsKaty Slemon
 
Kick start your journey as mern stack developer
Kick start your journey as mern stack developerKick start your journey as mern stack developer
Kick start your journey as mern stack developerShrutiPanjwani1
 
Building your First MEAN App
Building your First MEAN AppBuilding your First MEAN App
Building your First MEAN AppMongoDB
 
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical UniversityASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical UniversitySyed Shanu
 
From Web App Model Design to Production with Wakanda
From Web App Model Design to Production with WakandaFrom Web App Model Design to Production with Wakanda
From Web App Model Design to Production with WakandaAlexandre Morgaut
 
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?MarkupBox
 

La actualidad más candente (20)

MongoDB World 2019: Fast Machine Learning Development with MongoDB
MongoDB World 2019: Fast Machine Learning Development with MongoDBMongoDB World 2019: Fast Machine Learning Development with MongoDB
MongoDB World 2019: Fast Machine Learning Development with MongoDB
 
Full stack development tools &amp; technologies
Full stack development tools &amp; technologiesFull stack development tools &amp; technologies
Full stack development tools &amp; technologies
 
Grokking #9: Building a real-time and offline editing service with Couchbase
Grokking #9: Building a real-time and offline editing service with CouchbaseGrokking #9: Building a real-time and offline editing service with Couchbase
Grokking #9: Building a real-time and offline editing service with Couchbase
 
Introduction of ASP.NET MVC and AngularJS
Introduction of ASP.NET MVC and AngularJSIntroduction of ASP.NET MVC and AngularJS
Introduction of ASP.NET MVC and AngularJS
 
Project Dpilot Documentation
Project Dpilot DocumentationProject Dpilot Documentation
Project Dpilot Documentation
 
Valentine with Angular js - Introduction
Valentine with Angular js - IntroductionValentine with Angular js - Introduction
Valentine with Angular js - Introduction
 
Mean PPT
Mean PPTMean PPT
Mean PPT
 
React.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UIReact.js - and how it changed our thinking about UI
React.js - and how it changed our thinking about UI
 
Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6
 
Jasmine - A BDD test framework for JavaScript
Jasmine - A BDD test framework for JavaScriptJasmine - A BDD test framework for JavaScript
Jasmine - A BDD test framework for JavaScript
 
Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC Design & Development of Web Applications using SpringMVC
Design & Development of Web Applications using SpringMVC
 
Asp.net mvc 5 course module 1 overview
Asp.net mvc 5 course   module 1 overviewAsp.net mvc 5 course   module 1 overview
Asp.net mvc 5 course module 1 overview
 
The fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose ReactThe fundamental problems of GUI applications and why people choose React
The fundamental problems of GUI applications and why people choose React
 
Combining react with node js to develop successful full stack web applications
Combining react with node js to develop successful full stack web applicationsCombining react with node js to develop successful full stack web applications
Combining react with node js to develop successful full stack web applications
 
Kick start your journey as mern stack developer
Kick start your journey as mern stack developerKick start your journey as mern stack developer
Kick start your journey as mern stack developer
 
Building your First MEAN App
Building your First MEAN AppBuilding your First MEAN App
Building your First MEAN App
 
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical UniversityASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
 
From Web App Model Design to Production with Wakanda
From Web App Model Design to Production with WakandaFrom Web App Model Design to Production with Wakanda
From Web App Model Design to Production with Wakanda
 
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
AngularJS vs React JS vs Node JS: Which is Best For Web Development ?
 
OSGi with the Spring Framework
OSGi with the Spring FrameworkOSGi with the Spring Framework
OSGi with the Spring Framework
 

Similar a MongoDB Days UK: Building Apps with the MEAN Stack

Building Your First App with MongoDB
Building Your First App with MongoDBBuilding Your First App with MongoDB
Building Your First App with MongoDBMongoDB
 
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN StackMongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN StackMongoDB
 
Mongoose and MongoDB 101
Mongoose and MongoDB 101Mongoose and MongoDB 101
Mongoose and MongoDB 101Will Button
 
Back to Basics 2017: Mí primera aplicación MongoDB
Back to Basics 2017: Mí primera aplicación MongoDBBack to Basics 2017: Mí primera aplicación MongoDB
Back to Basics 2017: Mí primera aplicación MongoDBMongoDB
 
Introduction to Swagger
Introduction to SwaggerIntroduction to Swagger
Introduction to SwaggerKnoldus Inc.
 
Zero to Hipster with the M.I.K.E. Stack
Zero to Hipster with the M.I.K.E. StackZero to Hipster with the M.I.K.E. Stack
Zero to Hipster with the M.I.K.E. StackJen Looper
 
Lighting a Beacon: training for (future) implementers
Lighting a Beacon: training for (future) implementersLighting a Beacon: training for (future) implementers
Lighting a Beacon: training for (future) implementersCINECAProject
 
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...JavaScripters Community
 
Retail referencearchitecture productcatalog
Retail referencearchitecture productcatalogRetail referencearchitecture productcatalog
Retail referencearchitecture productcatalogMongoDB
 
Evolving your Data Access with MongoDB Stitch - Drew Di Palma
Evolving your Data Access with MongoDB Stitch - Drew Di PalmaEvolving your Data Access with MongoDB Stitch - Drew Di Palma
Evolving your Data Access with MongoDB Stitch - Drew Di PalmaMongoDB
 
MIKE Stack Introduction - MongoDB, io.js, KendoUI, and Express
MIKE Stack Introduction - MongoDB, io.js, KendoUI, and ExpressMIKE Stack Introduction - MongoDB, io.js, KendoUI, and Express
MIKE Stack Introduction - MongoDB, io.js, KendoUI, and ExpressCharlie Key
 
Building HTTP API's with NodeJS and MongoDB
Building HTTP API's with NodeJS and MongoDBBuilding HTTP API's with NodeJS and MongoDB
Building HTTP API's with NodeJS and MongoDBdonnfelker
 
Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)Katy Slemon
 
Introducing MongoDB Stitch, Backend-as-a-Service from MongoDB
Introducing MongoDB Stitch, Backend-as-a-Service from MongoDBIntroducing MongoDB Stitch, Backend-as-a-Service from MongoDB
Introducing MongoDB Stitch, Backend-as-a-Service from MongoDBMongoDB
 
Secure Coding For Java - Une introduction
Secure Coding For Java - Une introductionSecure Coding For Java - Une introduction
Secure Coding For Java - Une introductionSebastien Gioria
 
Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...
Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...
Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...MongoDB
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformAntonio Peric-Mazar
 

Similar a MongoDB Days UK: Building Apps with the MEAN Stack (20)

Building Your First App with MongoDB
Building Your First App with MongoDBBuilding Your First App with MongoDB
Building Your First App with MongoDB
 
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN StackMongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
 
Node js crash course session 5
Node js crash course   session 5Node js crash course   session 5
Node js crash course session 5
 
Mongoose and MongoDB 101
Mongoose and MongoDB 101Mongoose and MongoDB 101
Mongoose and MongoDB 101
 
Node.js and Parse
Node.js and ParseNode.js and Parse
Node.js and Parse
 
Back to Basics 2017: Mí primera aplicación MongoDB
Back to Basics 2017: Mí primera aplicación MongoDBBack to Basics 2017: Mí primera aplicación MongoDB
Back to Basics 2017: Mí primera aplicación MongoDB
 
Introduction to Swagger
Introduction to SwaggerIntroduction to Swagger
Introduction to Swagger
 
Zero to Hipster with the M.I.K.E. Stack
Zero to Hipster with the M.I.K.E. StackZero to Hipster with the M.I.K.E. Stack
Zero to Hipster with the M.I.K.E. Stack
 
Lighting a Beacon: training for (future) implementers
Lighting a Beacon: training for (future) implementersLighting a Beacon: training for (future) implementers
Lighting a Beacon: training for (future) implementers
 
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
 
Retail referencearchitecture productcatalog
Retail referencearchitecture productcatalogRetail referencearchitecture productcatalog
Retail referencearchitecture productcatalog
 
Evolving your Data Access with MongoDB Stitch - Drew Di Palma
Evolving your Data Access with MongoDB Stitch - Drew Di PalmaEvolving your Data Access with MongoDB Stitch - Drew Di Palma
Evolving your Data Access with MongoDB Stitch - Drew Di Palma
 
MIKE Stack Introduction - MongoDB, io.js, KendoUI, and Express
MIKE Stack Introduction - MongoDB, io.js, KendoUI, and ExpressMIKE Stack Introduction - MongoDB, io.js, KendoUI, and Express
MIKE Stack Introduction - MongoDB, io.js, KendoUI, and Express
 
Building HTTP API's with NodeJS and MongoDB
Building HTTP API's with NodeJS and MongoDBBuilding HTTP API's with NodeJS and MongoDB
Building HTTP API's with NodeJS and MongoDB
 
Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)
 
Introducing MongoDB Stitch, Backend-as-a-Service from MongoDB
Introducing MongoDB Stitch, Backend-as-a-Service from MongoDBIntroducing MongoDB Stitch, Backend-as-a-Service from MongoDB
Introducing MongoDB Stitch, Backend-as-a-Service from MongoDB
 
Secure Coding For Java - Une introduction
Secure Coding For Java - Une introductionSecure Coding For Java - Une introduction
Secure Coding For Java - Une introduction
 
Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...
Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...
Webinar: Developing with the modern App Stack: MEAN and MERN (with Angular2 a...
 
Building APIs in an easy way using API Platform
Building APIs in an easy way using API PlatformBuilding APIs in an easy way using API Platform
Building APIs in an easy way using API Platform
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 

Más de 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
 

Más de 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...
 

Último

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
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
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
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
 
"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
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
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
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
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
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
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
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 

Último (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 
"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 ...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
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
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
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
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
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
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 

MongoDB Days UK: Building Apps with the MEAN Stack

  • 1.
  • 3. Get ready to be MEAN!
  • 5. 5 Building and MEAN app • MongoDB is great for storing web/mobile app data • So let’s build a REST API using Node.js! – learn a bit about overall MEAN Stack libraries –learn a few MongoDB schema design principles
  • 7. 7 Overview • Part 1: Shopping Cart Application – Search for products – Add them to your cart – Check out with Stripe • Part 2: Using the Mongoose ODM • Part 3: Schema Design • Part 4: Building an API with the Express framework • Part 5: Front End w/ Angular
  • 8. Part 1: Let's Build a Shopping Cart
  • 10. 10 Add Product to Shopping Cart
  • 13. "Bad programmers worry about the code. Good programmers worry about data structures and their relationships." - Linus Torvalds 3 schemas for 3 collections Products Categories Users
  • 14. 16 Schema Relationships Entity A Entity B 1 1 Document A Document B Entity A Entity B 1 N Document A Array of B's Entity A Entity B 1 NNNN Entity A Entity B N N Document A Document B
  • 15. 17 Schema Relationships Products Categories N 1 Users Shopping Cart 1 N Shopping Cart Products N N
  • 16. 18 Schema Relationships • Product belongs to one or more categories • Users can have multiple products in their cart • Representing relationships in MongoDB is tricky ( different from doing a traditional RDBMS system – based on the usage patterns of data) • But that’s what mongoose HELPS A LOT!
  • 17. Part 2: Using the Mongoose ODM
  • 19. 21 Your first Mongoose Schema! var mongoose = require('mongoose'); module.exports = new mongoose.Schema( { name:{ type: String, required: true, } email:{ type: String, required: true, match: /.+@.+..+/, lowercase: true }, loggedInCounter:{ type: Number, default: 0, } }); "require" mongoose Define fields Field types, validation rules and attributes
  • 20. Document Validation Available on 3.2.0-RC2 https://jira.mongodb.org/browse/SERVER-18227 http://www.eliothorowitz.com/blog/2015/09/11/document-validation-and-what-dynamic- schema-means/
  • 21. 23 Using your schemavar mongoose = require('mongoose'); var schema = require('./schemas/user'); mongoose.connect('mongodb://localhost:27017/meancart'); var User = mongoose.Model('User', schema, 'users'); var newuser = new User({ name: 'Jose Mourinho', email: 'specialone@chelseafc.co.uk', }); newuser.save( function(error){ if (error){ console.log(error); process.exit(1); } User.find({email: 'specialone@chelseafc.co.uk'}, function(error, docs){ if(error){ console.log(error); process.exit(1); } console.log(require('util').inspect(docs)); process.exit(1); }); } ); Tell mongoose where to connect Create model using given schema and initialize object Save user and load it from MongoDB
  • 22. 24 Takeaways • Mongoose provides several neat features – MVC model –Default values – Schema validation –Declarative schema design
  • 23. Part 3: Schema Design
  • 24. 26 Schema Design • 3 schemas – Product –Category – User • Define Mongoose schemas • Focus on a couple of key design principles
  • 25. 27 Category Schema var mongoose = require('mongoose'); var categorySchema = { _id: { type: String}, parent: { type: String, ref: 'Category', }, ancestors: [{ type: String, ref: 'Category' }] }; module.exports = new mongoose.Schema(categorySchema); module.exports.categorySchema = categorySchema; Inner sub-document array Self "join" reference http://mongoosejs.com/docs/populate.html
  • 26. $lookup Go and try it out w/ 3.2.0-RC2: https://jira.mongodb.org/browse/SERVER-19095 https://www.mongodb.com/blog/post/thoughts-on-new-feature-lookup
  • 27. 29 Product Schema var mongoose = require('mongoose'); var Category = require('./category'); var productSchema = { name: { type: String, required: true }, pictures: [{ type: String, match: /^http:///i}], price: { amount: { type: Number, required: true}, currency: { type: String, enum: ['USD', 'EUR', 'GBP'], required: true }, }, category: Category.categorySchema }; module.exports = new mongoose.Schema(productSchema); module.exports.productSchema = productSchema; Category Schema
  • 28. 30 Creating a Productvar mongoose = require('mongoose'); var productSchema = require('./product'); var Product = mongoose.model('Product', productSchema); var p = new Product({ name: 'chelsea scarf blue', price: { amount: 12.97, currency: 'GBP', }, category:{ name:'scarfs' } }); p.name = 2; console.log(p.name); //2 console.log(p.$isValid('name')); // true p.price.amount = 'Not a number'; console.log(p.$isValid('price.amount')); //false p.validate(function(err){ // CastError because `price.amount` couldn't be // casted to a number console.log(err); }); Cast Validation Invalid Cast Validation Method
  • 29. 31 Category Schema Queries • What categories are descent of "wearables" ? • What categories are children of "accessories"? • What categories are ancestors of "scarf"? db.category.find( {'ancestors': 'wearables'}) {"_id": "wearables", "parent": "accessories", "ancestors": ["accessories","wearables"]} {"_id": "scarfs", "parent": "wearables", "ancestors": ["accessories", "wearables", "scarfs"]} db.category.find( {'parent': "accessories"}) {"_id": "wearables", "parent": "accessories", "ancestors": ["accessories","wearables"]} db.category.find( {'_id': 'scarf'}, {"_id":0, "ancestors":1}) {"ancestors": ["accessories","wearables"]}
  • 30. 32 … make sure that: • Queries should be simple! • Strive for minimal data transformation by server – Store what you query for – How you use data defines your schema • Aggregation Framework can complement complex queries but – are heavy – required resources
  • 31. 33 User Schemavar mongoose = require('mongoose'); var userSchema = { profile: { username: { type: String, required: true; lowercase: true; }, picture:{ type: String, required: true, match: /^http:///i, }, }, data:{ cart:[{ product: { type: mongoose.Schema.Types.ObjectId }, quantity:{ type: Number, defalt: 1, min: 1 } }] } }; module.exports = new mongoose.Schema(userSchema); module.exports.userSchema = userSchema; Embedded Cart Entity Watch out for unbounded arrays!
  • 32. 34 Cardinality Matters • Product and user = many-to-many relationship • User won't have 1000s of products in a cart
  • 33. 35 Cardinality Matters • Product and user = many-to-many relationship • User won't have 1000s of products in a cart • Embedded array to represent that relationship Shopping Cart Products N N
  • 34. 36 Linking vs. Embedding • Embedding –Great for read performance –Heavier writes –Great for many-to-one when many is known! • Linking –Allows more Flexibility –Extra work on read workloads –Simpler writes
  • 36. 38 Express JS Popular Node.js web framework Simple, pluggable and fast Great for build REST APIs http://expressjs.com/
  • 37. Your First ExpressApp var express = require('express'); var app = express(); app.get('/products', function(req, res){ var limit = 10; Product.find().limit(10).populate('category'). exec( function(err, docs){ if(err){ console.log('something is wrong: '+err.toString()); return res.status(status.INTERNAL_SERVER_ERROR). json({error: err.toString()}); } res.json({products: docs}); }); }); //start listening app.listen(3000); console.log("super REST app running"); Initiate app objects Define route and method Use Model to execute database calls
  • 39. 41 Structure your REST API var bodyParser = require('body-parser'); var express = require('express'); var app = express(); //body parser for json payloads app.use(bodyParser.json()); //api version app.use('/api/v1', require('./api'); //start listening app.listen(3000); console.log("super REST app running"); Define a separate module for your version implementation
  • 40. Structure your REST API var express = require('express'); var status = require('http-status'); var mongoose = require('mongoose'); var productSchema = require('./schemas/product'); mongoose.connect('mongodb://localhost/test'); var Product = mongoose.model('Product', productSchema); var api = express.Router(); api.get('/products', function(req, res){ var limit = 10; var items = Product.find().limit(10). populate('category'). exec( function(err, docs){ if(err){ console.log('something went wrong: '+err.toString()); return res.status(status.INTERNAL_SERVER_ERROR). json({error: err.toString()}); } res.json({products: docs}); }); }); module.exports = api; Express Router object Define route and method
  • 41. 43 GET /category/parent/:id function errorHandler(res, err){ console.log('something went wrong: '+err.toString()); return res.status(status.INTERNAL_SERVER_ERROR). json({error: err.toString()}); } api.get('/products', function(req, res){ ... }); api.get('/category/parent/:id'), function(req, res){ var query = { parent: req.params.id}; var sort = {_id: -1}; Category.find(query).sort(sort).exec(function(err, docs){ if (err){ return errorHandler(res, err); } res.json({categories: docs}); }); }); Define route Handle params and create queries
  • 42. 44 Adding Products to User's Cart api.put('/me/cart', function(req, res){ try{ var cart = req.body.cart; }catch(e){ return errorHandler(res, error); } req.user.data.cart = cart; req.user.save(function(err, user){ if(err){ return errorHandler(res, err); } return res.json({user: user}); }); }); Overwrite user's cart Let mongoose handle validation and casting of data Mongoose lets you be lazy Access control using subdocuments var userSchema = { profile: {...}, data:{ oauth: {type:String, required: true}, cart:[{ product: { type: mongoose.Schema.Types.ObjectId }, quantity:{type: Number, defalt: 1,min: 1 } }] } };
  • 43. 45 Takeaways • Express REST API on top of Mongoose – Access control –Business logic – Decoupling database logic and access
  • 45. 47 AngularJS Front End Library Extensible Client Side MVC https://angularjs.org/
  • 46. Front End Server var express = require('express'); var app = express(); app.use(express.static('front')); app.get('/', function(req, res){ //load html page and let angular do all the wiring res.sendfile('./front/index.html'); }); var server = app.listen(8080, function () { var host = server.address().address; var port = server.address().port; console.log('Front end listening at http://%s:%s', host, port); }); Using expressjs Self "join" reference
  • 47. index.html <!doctype html> <html lang="en" ng-app="meancart" ng-controller="listController"> <head> <meta charset="utf-8"> <title>{{title}}</title> <link rel="stylesheet" href="css/bootstrap.min.css"> <script src="js/angular.min.js"></script> <script src="js/controllers.js"></script> </head> App and Controller
  • 48. Angular Controllers const RESTSERVER = "http://localhost:3000"; var app = angular.module('meancart', []); app.controller('listController', function($scope, $http){ $http.get(RESTSERVER+"/api/v1/products").success( function( response ){ $scope.title= "MEAN Cart!"; $scope.name= "List of Products"; $scope.list = response._items; }); } ); Backend REST server call
  • 49. Templates <!--index.html--> <div class="col-md-10"> <div ng-include="'/templates/list.html'"></div> </div> <!--list.html--> <br> <ul class="media-list"> <li ng-repeat="item in list|filter:query" class="media"> <div ng-include="'templates/item.html'"></div> </li> </ul> <!--item.html <a class="pull-left" href="{{item.url}}"> <img class="img-responsive" src="{{item.img}}"> </a> <div class="media-body"> <h4 class="media-heading">{{item.name}}</h4> </div>
  • 51. Checkout w/ Stripe Stripe = require('stripe'); api.post('/checkout', function(req, res){ if(!req.user){...} req.user.populate( {path: 'data.cart.product', model:'Product'}, function(err, user){ var totalCostGBP = 0; _.each(user.data.cart, function(item){ totalCostGBP += item.product.amount * item.quantity; }); Stripe.charges.create({ // Stripe requires the price in cents amount: Math.ceil(totalCostGBP*100), currency: 'gbp', source: req.body.stripeToken, description: 'Thank you for your money' }, function(err, charge){...} ); }); }); Populate the user object Import Stripe module and create a charge
  • 53. 55 MEAN Stack • Flexible Stack • Features, features, features –Lots of libraries available • Strong community support ps – runs on the best database in the world!!!
  • 54. 56 Edx MEAN Stack Online Course https://www.edx.org/course/introduction-mongodb-using-mean-stack-mongodbx-m101x

Notas del editor

  1. Quick introduction to MongoDB MongoMK, basic components and functionality – data formats structure Sizing considerations Deploy strategies and architecture Operational best practices and hints on effective monitoring, backups and automation
  2. MEAN stack is mostly for web and mobile applications and mongodb is also a great tool to use has database backend for those kinds of applications.
  3. CHANGE THIS WORDING
  4. Schema validation and pseudo-joins
  5. Ok, so you started with a model and now you decided that you actually want to migrate data together by embedding the collection together. Well, you have options
  6. Model view
  7. Ok, so you started with a model and now you decided that you actually want to migrate data together by embedding the collection together. Well, you have options
  8. Even when you start a rampant shopping spree!
  9. So
  10. API = Application Programing Interface