SlideShare a Scribd company logo
MongoDB dan Node.js
Sharing Session Ilmu Komputer UPI
Bagian 1, Sabtu 17 Februari 2018
Laboratorium Basis Data, Ilmu Komputer, FPMIPA, Universitas
Pendidikan Indonesia
Konsep Relasional (MySQL,
PostgreSQL, Oracle, etc)
User
User Skill
User
Contact
Jobs
Position
1
n
1
n
1
n
Konsep Dokumen (MongoDB,
CouchDB, etc)
{
name: "Kurnia Jaya",
address: "Leles, Garut",
email: "kurnia.jaya@gmail.com",
jobs_position: "Mobile Application Developer",
skills: [
"Android",
"React-Native",
"Xamarin"
],
contacts: [
{ type: "phone", order: 1, value: "7507722"},
{ type: "mobile phone", order: 2, value: "085723457233"},
{ type: "mobile phone", order: 3, value: "085723457255"},
]
}
Query Dasar
use jobsdb;
show dbs;
show collections;
Query Dasar - Insert
db.mycollection.insert({});
db.mycollection.insertMany([{}, {}, ... ]);
Query Dasar - Select
db.mycollection.find({});
db.mycollection.createIndex({});
db.mycollection.find({}).sort({});
db.mycollection.find({}).sort({}).limit({});
db.mycollection.findOne();
db.mycollection.count();
Query Dasar - Update
db.mycollection.update({}, {});
Query Dasar - Delete
db.mycollection.remove({});
db.mycollection.drop;
db.dropDatabase();
Agregasi
db.restaurants.aggregate([
{
$group: {
_id: "$cuisine",
total: { $sum: 1 }
}
},
{
$sort: {
total: -1
}
}
]);
Agregasi
db.restaurants.aggregate([
{
$group: {
_id: "$address.zipcode",
total: { $sum: 1 }
}
},
{
$sort: {
total: -1
}
},
{
$limit: 10
}
]);
Agregasi
db.restaurants.aggregate([
{
$group: {
_id: {
cuisine: "$cuisine",
borough: "$borough"
},
total: { $sum: 1 }
}
},
{
$sort: {
total: -1
}
},
{
$limit: 10
}
]);
Agregasi
db.restaurants.aggregate([
{
$group: {
_id: {
cuisine: "$cuisine",
borough: "$borough"
},
total: { $sum: 1 }
}
},
{ $match: { total: { $gt: 1000 } } },
{
$sort: {
total: -1
}
},
{
$limit: 10
}
]);
Agregasi
db.restaurants.aggregate([
{ $match: { cuisine: { $eq: "Chinese" } } },
{
$group: {
_id: {
borough: "$borough"
},
total: { $sum: 1 }
}
},
{ $match: { total: { $gt: 100 } } },
{
$sort: {
total: -1
}
},
{
$limit: 10
}
]);
Full Text Search
db.restaurants.createIndex({name: "text"})
db.restaurants.find( { $text: { $search: "bakery -shop" } } ).limit(5);
Availibility
Replication Sharding
Replication
Replication
Replication
Replication
Sharding
Sharding
Sharding
Node.js dengan Mongoose
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
mongoose.connect('mongodb://localhost/jobsdb');
var ApplicantSchema = mongoose.model('Applicant', new Schema({
name: String,
address: String,
email: String,
jobs_position: String,
skills: Array,
contacts: Array //{ type: "phone", order: 1, value: "7501234"}
})
);
module.exports = {
ApplicantSchema
}
Node.js dengan Mongoose
var models = require("./models");
const applicant = models.ApplicantSchema;
applicant.find({}).then((rows) => {
console.log(rows);
console.log("Find success!");
process.exit(0);
}).catch((err) => {
console.log(err);
})
Referensi
●
https://docs.mongodb.com/manual/
●
http://mongoosejs.com/docs/guide.html
●
https://github.com/ridwanbejo/ilkom-mongodb-meetup-feb-2018
DEMO

More Related Content

PPTX
Mongo db basic installation
PDF
Mongo db for c# developers
PDF
MongoDB and its usage
PPTX
MongoDB + Spring
PPTX
MongoDB and Spring - Two leaves of a same tree
PPTX
mongoyeieheheieueheheueuehwwuwuuuwuwh.pptx
PPTX
Bi presentation
KEY
Introduction to MongoDB
Mongo db basic installation
Mongo db for c# developers
MongoDB and its usage
MongoDB + Spring
MongoDB and Spring - Two leaves of a same tree
mongoyeieheheieueheheueuehwwuwuuuwuwh.pptx
Bi presentation
Introduction to MongoDB

Similar to Mongodb intro-1-asbasdat-2018 (20)

PDF
NDC London 2013 - Mongo db for c# developers
PPTX
Mongoose and MongoDB 101
PPTX
Database Trends for Modern Applications: Why the Database You Choose Matters
PPT
Building Your First MongoDB App ~ Metadata Catalog
PPTX
Full Stack Development with Node.js and NoSQL
PPTX
Full stack development with node and NoSQL - All Things Open - October 2017
KEY
MongoDB, PHP and the cloud - php cloud summit 2011
PDF
Which Questions We Should Have
PDF
MongoDB
KEY
London MongoDB User Group April 2011
PPTX
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
PPTX
Mongodb ExpressJS HandlebarsJS NodeJS FullStack
PDF
MongoDB for Coder Training (Coding Serbia 2013)
PDF
Back to Basics 2017: Mí primera aplicación MongoDB
PPTX
Webinar: Building Your First App in Node.js
PPTX
Webinar: Building Your First App in Node.js
PDF
Doctrine MongoDB ODM (PDXPHP)
PPTX
Dev Jumpstart: Build Your First App with MongoDB
PPTX
Introduction to MongoDB
PPTX
Intro To Mongo Db
NDC London 2013 - Mongo db for c# developers
Mongoose and MongoDB 101
Database Trends for Modern Applications: Why the Database You Choose Matters
Building Your First MongoDB App ~ Metadata Catalog
Full Stack Development with Node.js and NoSQL
Full stack development with node and NoSQL - All Things Open - October 2017
MongoDB, PHP and the cloud - php cloud summit 2011
Which Questions We Should Have
MongoDB
London MongoDB User Group April 2011
Webinaire 2 de la série « Retour aux fondamentaux » : Votre première applicat...
Mongodb ExpressJS HandlebarsJS NodeJS FullStack
MongoDB for Coder Training (Coding Serbia 2013)
Back to Basics 2017: Mí primera aplicación MongoDB
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
Doctrine MongoDB ODM (PDXPHP)
Dev Jumpstart: Build Your First App with MongoDB
Introduction to MongoDB
Intro To Mongo Db
Ad

More from Ridwan Fadjar (20)

PDF
Google Cloud Platform for Python Developer - Beginner Guide.pdf
PDF
My Hashitalk Indonesia April 2024 Presentation
PDF
PyCon ID 2023 - Ridwan Fadjar Septian.pdf
PDF
Cloud Infrastructure automation with Python-3.pdf
PDF
GraphQL- Presentation
PDF
Bugs and Where to Find Them (Study Case_ Backend).pdf
PDF
Introduction to Elixir and Phoenix.pdf
PDF
Ridwan Fadjar Septian PyCon ID 2021 Regular Talk - django application monitor...
PDF
CS meetup 2020 - Introduction to DevOps
PDF
Why Serverless?
PDF
SenseHealth Indonesia Sharing Session - Do we really need growth mindset (1)
PDF
Risk Analysis of Dutch Healthcare Company Information System using ISO 27001:...
PDF
A Study Review of Common Big Data Architecture for Small-Medium Enterprise
PDF
Mongodb intro-2-asbasdat-2018-v2
PDF
Mongodb intro-2-asbasdat-2018
PDF
Resftul API Web Development with Django Rest Framework & Celery
PDF
Memulai Data Processing dengan Spark dan Python
PDF
Kisah Dua Sejoli: Arduino & Python
PDF
Mengenal Si Ular Berbisa - Kopi Darat Python Bandung Desember 2014
PDF
Modul pelatihan-django-dasar-possupi-v1
Google Cloud Platform for Python Developer - Beginner Guide.pdf
My Hashitalk Indonesia April 2024 Presentation
PyCon ID 2023 - Ridwan Fadjar Septian.pdf
Cloud Infrastructure automation with Python-3.pdf
GraphQL- Presentation
Bugs and Where to Find Them (Study Case_ Backend).pdf
Introduction to Elixir and Phoenix.pdf
Ridwan Fadjar Septian PyCon ID 2021 Regular Talk - django application monitor...
CS meetup 2020 - Introduction to DevOps
Why Serverless?
SenseHealth Indonesia Sharing Session - Do we really need growth mindset (1)
Risk Analysis of Dutch Healthcare Company Information System using ISO 27001:...
A Study Review of Common Big Data Architecture for Small-Medium Enterprise
Mongodb intro-2-asbasdat-2018-v2
Mongodb intro-2-asbasdat-2018
Resftul API Web Development with Django Rest Framework & Celery
Memulai Data Processing dengan Spark dan Python
Kisah Dua Sejoli: Arduino & Python
Mengenal Si Ular Berbisa - Kopi Darat Python Bandung Desember 2014
Modul pelatihan-django-dasar-possupi-v1
Ad

Recently uploaded (20)

PDF
Empathic Computing: Creating Shared Understanding
PDF
cuic standard and advanced reporting.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPT
Teaching material agriculture food technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Modernizing your data center with Dell and AMD
PDF
Approach and Philosophy of On baking technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
KodekX | Application Modernization Development
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Review of recent advances in non-invasive hemoglobin estimation
Empathic Computing: Creating Shared Understanding
cuic standard and advanced reporting.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Teaching material agriculture food technology
“AI and Expert System Decision Support & Business Intelligence Systems”
Modernizing your data center with Dell and AMD
Approach and Philosophy of On baking technology
Per capita expenditure prediction using model stacking based on satellite ima...
Unlocking AI with Model Context Protocol (MCP)
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
NewMind AI Monthly Chronicles - July 2025
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
20250228 LYD VKU AI Blended-Learning.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
KodekX | Application Modernization Development
Mobile App Security Testing_ A Comprehensive Guide.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Review of recent advances in non-invasive hemoglobin estimation

Mongodb intro-1-asbasdat-2018