SlideShare a Scribd company logo
1 of 45
Download to read offline
OPENSHIFT
Workshop
PRESENTED
BY
Shekhar
Gulati
Building Spatial Back-ends
with Node.js and MongoDB
AGENDA
➔ Learn a bit about Node.js and Express
➔ Learn some MongoDB basics
➔ Build a location aware Job search application
➔ Go live with a Node.js MongoDB powered app in
~ 45 mins
Write an application and host it on internet
http://localjobsdemo-shekhargulati.rhcloud.com/
GOAL
CODE DU JOUR
https://github.com/shekhargulati/localjobs-nodejs
● You know JavaScript
● You know Git
● You like to write code rather than
managing servers.
ASSUMPTIONS
There are no stupid questions only stupid
answers. So ask questions
ASK QUESTIONS
Node.js provides a purely event-driven ,
non-blocking infrastructure to script
highly concurrent programs.
NODE.JS
NODE.JS EXPLAINED
Node.js goal is to provide an easy way to
build scalable network applications.
Some ex. Web servers , TCP servers,
Streaming server , Realtime apps, etc.
NODE.JS GOAL
Node.js is Server Side JavaScript.
● It provides runtime environment
● It provides a library
NODE.JS IS
● Non Blocking I/O
● Based on Google's Chrome V8 engine
● 40k + modules
● Active community
● Multi platform – Windows , Mac , and Linux
● Use single language for both client and
server.
● JavaScript is language of Web.
WHY NODE.JS
● Go to http://nodejs.org/ and click install.
● Install the downloaded package.
INSTALLING NODE.JS
● Hello World
● HTTP Server
NODE.JS IN ACTION
● Routing support
● Template support
● Error handling
● Etc.
EXPRESS TO RESCUE
Web Application Framework for Node
● Install Express
– npm install express -g
● Create a new Express application
– express --sessions --ejs hello-world
MONGODB
18

Open Source NoSQL document datastore
– JSON style documents

Schema-less
– Each document is heterogeneous, and may have completely
unique structure compared to other documents

Fast and horizontally scalable

Rich query language

Rich documents

Easy to get running

Geospatial indexing
WHAT IS MONGODB
Database → Database
Table → Collection
Row → Document
Index → Index
STEP 4 :
MONGODB TERMINOLOGY
DEMO TIME
21

What is it for?

Find all the MongoDB jobs near me – Proximity Queries

Find all the MongoDB jobs within Bangalore – Bounded
Queries

Find all the MongoDB job at this location – Exact Queries
●
Supports only two dimensional indexes.

You can only have one geospatial index per collection.

By default, 2d geospatial indexes assume longitude
and latitude have boundaries of -180 inclusive and 180
non-inclusive (i.e. [-180, 180))
GEOSPATIAL INDEXING
BASICS
22
1) Put your coordinates into an array
{ loc : [ 50 , 30 ] } //SUGGESTED OPTION
{ loc : { x : 50 , y : 30 } }
{ loc : { foo : 50 , y : 30 } }
1) { loc : { lon : 40.739037, lat: 73.992964 } }
2) Make a 2d index
db.places.ensureIndex( { loc : "2d" } )
3) If you use latitude and longitude as your coordinate system,
always store longitude first. MongoDB’s 2d spherical index
operators only recognize [ longitude, latitude] ordering.
HOW TO MAKE IT WORK
23
APP DEVELOPMENT
LocalJobs : Location Aware Job Search App
Functionalities or User stories or Features
1. As an Employer , I should be able to register my
company
2. As an Employer, I should be able to post jobs
3. As a Job seeker , I should be able to register myself with
application
4. As a Job seeker , I should be able to search jobs near to
my current location.
5. As a Job seeker , I should be able to apply a job
6. Etc...
APP -- USER STORIES
Prioritize the functionalities or user stories or features
– As an Employer, I should be able to post jobs
– As a Job seeker , I should be able to search jobs near
to my current location.
– As a Job seeker , I should be able to see all the jobs
PRIORITIZE
$ git clone https://github.com/shekhargulati/localjobs-nodejs.git
STEP 0 : CLONE REPO
$ git checkout 380e795c9b52235838c361f9052f188e054c0ea8
$ npm install -l
STEP 1 : APP INIT
$ git checkout b721308a8945b28019731791a5a1188ba3d855b6
$ npm install -l
STEP 2 : INDEX PAGE
$ git checkout edbec3f6df758e6287f7c8ded6098ada9262282
$ npm install -l
STEP 3 : SAVE JOB
$ git checkout 457eb572b0d74c649b56c26306a1d5bcdd01a9e1
STEP 4 : VIEW ALL JOBS
$ git checkout a9e50f4feb1448c924758ed968d8253da3c06070
Create MongoDB 2d Index
STEP 5 : SEARCH BY NEAR
$ git checkout 82a6cefe0514d1b81d0b8446412a16340465590d
STEP 6 : SEARCH BY GEONEAR
$ ./mongoimport --db localjobs --collection jobs –file jobs.json
STEP 7 : IMPORT DATA
34
APPLICATION DEPLOYMENT
PaaS == Platform as a Service
A Cloud Application Platform
Code Deploy Enjoy
Save Time and Money
Code your app
Push-button
Deploy, and
your App is
running in
the Cloud!
38
OpenShift
is
PaaS by Red Hat
Multi-language,
Auto-Scaling,
Self-service,
Elastic,
Cloud Application
Platform
39
OUR STACK
40
https://openshift.redhat.com/app/account/new
Promo code is JSCHANNEL13
CREATING OPENSHIFT
ACCOUNT
● Free! No time limit
● 3 gears (like servers) - each 512 Mb RAM, 1 Gb disk
● Auto-scaling
● Simple pricing
BUT WAIT – THERE's MORE
42
rhc create-app localjobs nodejs mongodb-2.2 --from-code=
https://github.com/shekhargulati/localjobs-nodejs.git
Lot of other tasks you can do with rhc – tail log, app management,
cartridge management , ssh management , namespace
management, etc. Run rhc -h for details
DEMO : LOCALJOBS APP
RHC is only required for infrastructure tasks
43
git push
IN CASE YOU CARE
•
Shekhar Gulati – Works at Red Hat
•
Principal OpenShift Developer Evangelist
•
Java / Python/ JavaScript / NoSQL / Cloud Guy
•
Twitter Handle : shekhargulati
•
Github https://github.com/shekhargulati
•
Slides https://speakerdeck.com/shekhargulati
QUESTIONS?

More Related Content

Similar to Building spatial back ends with Node.js and MongoDB

Serverless Preview Environments @ Boston DevOps
Serverless Preview Environments @ Boston DevOpsServerless Preview Environments @ Boston DevOps
Serverless Preview Environments @ Boston DevOpsJoseph Lust
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsMongoDB
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsMongoDB
 
How to integrate front end tool via gruntjs
How to integrate front end tool via gruntjsHow to integrate front end tool via gruntjs
How to integrate front end tool via gruntjsBo-Yi Wu
 
Mongo db bangalore
Mongo db bangaloreMongo db bangalore
Mongo db bangaloreMongoDB
 
Taking containers from development to production
Taking containers from development to productionTaking containers from development to production
Taking containers from development to productionSuraj Deshmukh
 
Making kubernetes simple for developers
Making kubernetes simple for developersMaking kubernetes simple for developers
Making kubernetes simple for developersSuraj Deshmukh
 
Running MongoDB Enterprise on Kubernetes
Running MongoDB Enterprise on KubernetesRunning MongoDB Enterprise on Kubernetes
Running MongoDB Enterprise on KubernetesAriel Jatib
 
Docker and Your Path to a Better Staging Environment - webinar by Gil Tayar
Docker and Your Path to a Better Staging Environment - webinar by Gil TayarDocker and Your Path to a Better Staging Environment - webinar by Gil Tayar
Docker and Your Path to a Better Staging Environment - webinar by Gil TayarApplitools
 
The Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IThe Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IOded Sagir
 
Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Shekhar Gulati
 
Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Slobodan Lohja
 
MeteorJS - How to start
MeteorJS  -  How to startMeteorJS  -  How to start
MeteorJS - How to startDan Tran
 
Perl Tools for Productivity
Perl Tools for ProductivityPerl Tools for Productivity
Perl Tools for ProductivityTudor Constantin
 
Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014Stéphane Bégaudeau
 
Writing mruby Debugger
Writing mruby DebuggerWriting mruby Debugger
Writing mruby Debuggeryamanekko
 
AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
AzovDevMeetup 2016 | Angular 2: обзор | Александр ШевнинAzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
AzovDevMeetup 2016 | Angular 2: обзор | Александр ШевнинJSC “Arcadia Inc”
 
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...Alessandro Molina
 

Similar to Building spatial back ends with Node.js and MongoDB (20)

Serverless Preview Environments @ Boston DevOps
Serverless Preview Environments @ Boston DevOpsServerless Preview Environments @ Boston DevOps
Serverless Preview Environments @ Boston DevOps
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
 
Webinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.jsWebinar: Building Your First App in Node.js
Webinar: Building Your First App in Node.js
 
How to integrate front end tool via gruntjs
How to integrate front end tool via gruntjsHow to integrate front end tool via gruntjs
How to integrate front end tool via gruntjs
 
Mongo db bangalore
Mongo db bangaloreMongo db bangalore
Mongo db bangalore
 
Taking containers from development to production
Taking containers from development to productionTaking containers from development to production
Taking containers from development to production
 
New paradigms
New paradigmsNew paradigms
New paradigms
 
Making kubernetes simple for developers
Making kubernetes simple for developersMaking kubernetes simple for developers
Making kubernetes simple for developers
 
Running MongoDB Enterprise on Kubernetes
Running MongoDB Enterprise on KubernetesRunning MongoDB Enterprise on Kubernetes
Running MongoDB Enterprise on Kubernetes
 
Docker and Your Path to a Better Staging Environment - webinar by Gil Tayar
Docker and Your Path to a Better Staging Environment - webinar by Gil TayarDocker and Your Path to a Better Staging Environment - webinar by Gil Tayar
Docker and Your Path to a Better Staging Environment - webinar by Gil Tayar
 
The Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IThe Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session I
 
Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud
 
Get shit done
Get shit doneGet shit done
Get shit done
 
Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021Intro to SpringBatch NoSQL 2021
Intro to SpringBatch NoSQL 2021
 
MeteorJS - How to start
MeteorJS  -  How to startMeteorJS  -  How to start
MeteorJS - How to start
 
Perl Tools for Productivity
Perl Tools for ProductivityPerl Tools for Productivity
Perl Tools for Productivity
 
Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014Modern Web Application Development Workflow - EclipseCon France 2014
Modern Web Application Development Workflow - EclipseCon France 2014
 
Writing mruby Debugger
Writing mruby DebuggerWriting mruby Debugger
Writing mruby Debugger
 
AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
AzovDevMeetup 2016 | Angular 2: обзор | Александр ШевнинAzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
AzovDevMeetup 2016 | Angular 2: обзор | Александр Шевнин
 
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
 

More from Shekhar Gulati

Modern web application development with java ee 7
Modern web application development with java ee 7Modern web application development with java ee 7
Modern web application development with java ee 7Shekhar Gulati
 
Working effectively with OpenShift
Working effectively with OpenShiftWorking effectively with OpenShift
Working effectively with OpenShiftShekhar Gulati
 
Developing Great Apps with Apache Cordova
Developing Great Apps with Apache CordovaDeveloping Great Apps with Apache Cordova
Developing Great Apps with Apache CordovaShekhar Gulati
 
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJSDeveloping Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJSShekhar Gulati
 
Developing modern java web applications with java ee 7 and angular js
Developing modern java web applications with java ee 7 and angular jsDeveloping modern java web applications with java ee 7 and angular js
Developing modern java web applications with java ee 7 and angular jsShekhar Gulati
 
Open shift for java(ee) developers
Open shift for java(ee) developersOpen shift for java(ee) developers
Open shift for java(ee) developersShekhar Gulati
 
Thinking beyond RDBMS - Building Polyglot Persistence Java Applications Devf...
Thinking beyond RDBMS  - Building Polyglot Persistence Java Applications Devf...Thinking beyond RDBMS  - Building Polyglot Persistence Java Applications Devf...
Thinking beyond RDBMS - Building Polyglot Persistence Java Applications Devf...Shekhar Gulati
 
Java EE 6 and NoSQL Workshop DevFest Austria
Java EE 6 and NoSQL Workshop DevFest AustriaJava EE 6 and NoSQL Workshop DevFest Austria
Java EE 6 and NoSQL Workshop DevFest AustriaShekhar Gulati
 
Power up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShiftPower up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShiftShekhar Gulati
 
A Happy Cloud Friendly Java Developer with OpenShift
A Happy Cloud Friendly Java Developer with OpenShiftA Happy Cloud Friendly Java Developer with OpenShift
A Happy Cloud Friendly Java Developer with OpenShiftShekhar Gulati
 
Indic threads java10-spring-roo-and-the-cloud
Indic threads java10-spring-roo-and-the-cloudIndic threads java10-spring-roo-and-the-cloud
Indic threads java10-spring-roo-and-the-cloudShekhar Gulati
 

More from Shekhar Gulati (11)

Modern web application development with java ee 7
Modern web application development with java ee 7Modern web application development with java ee 7
Modern web application development with java ee 7
 
Working effectively with OpenShift
Working effectively with OpenShiftWorking effectively with OpenShift
Working effectively with OpenShift
 
Developing Great Apps with Apache Cordova
Developing Great Apps with Apache CordovaDeveloping Great Apps with Apache Cordova
Developing Great Apps with Apache Cordova
 
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJSDeveloping Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJS
 
Developing modern java web applications with java ee 7 and angular js
Developing modern java web applications with java ee 7 and angular jsDeveloping modern java web applications with java ee 7 and angular js
Developing modern java web applications with java ee 7 and angular js
 
Open shift for java(ee) developers
Open shift for java(ee) developersOpen shift for java(ee) developers
Open shift for java(ee) developers
 
Thinking beyond RDBMS - Building Polyglot Persistence Java Applications Devf...
Thinking beyond RDBMS  - Building Polyglot Persistence Java Applications Devf...Thinking beyond RDBMS  - Building Polyglot Persistence Java Applications Devf...
Thinking beyond RDBMS - Building Polyglot Persistence Java Applications Devf...
 
Java EE 6 and NoSQL Workshop DevFest Austria
Java EE 6 and NoSQL Workshop DevFest AustriaJava EE 6 and NoSQL Workshop DevFest Austria
Java EE 6 and NoSQL Workshop DevFest Austria
 
Power up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShiftPower up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShift
 
A Happy Cloud Friendly Java Developer with OpenShift
A Happy Cloud Friendly Java Developer with OpenShiftA Happy Cloud Friendly Java Developer with OpenShift
A Happy Cloud Friendly Java Developer with OpenShift
 
Indic threads java10-spring-roo-and-the-cloud
Indic threads java10-spring-roo-and-the-cloudIndic threads java10-spring-roo-and-the-cloud
Indic threads java10-spring-roo-and-the-cloud
 

Recently uploaded

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 

Recently uploaded (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 

Building spatial back ends with Node.js and MongoDB

  • 2. AGENDA ➔ Learn a bit about Node.js and Express ➔ Learn some MongoDB basics ➔ Build a location aware Job search application ➔ Go live with a Node.js MongoDB powered app in ~ 45 mins
  • 3. Write an application and host it on internet http://localjobsdemo-shekhargulati.rhcloud.com/ GOAL
  • 5. ● You know JavaScript ● You know Git ● You like to write code rather than managing servers. ASSUMPTIONS
  • 6. There are no stupid questions only stupid answers. So ask questions ASK QUESTIONS
  • 7. Node.js provides a purely event-driven , non-blocking infrastructure to script highly concurrent programs. NODE.JS
  • 9. Node.js goal is to provide an easy way to build scalable network applications. Some ex. Web servers , TCP servers, Streaming server , Realtime apps, etc. NODE.JS GOAL
  • 10. Node.js is Server Side JavaScript. ● It provides runtime environment ● It provides a library NODE.JS IS
  • 11. ● Non Blocking I/O ● Based on Google's Chrome V8 engine ● 40k + modules ● Active community ● Multi platform – Windows , Mac , and Linux ● Use single language for both client and server. ● JavaScript is language of Web. WHY NODE.JS
  • 12. ● Go to http://nodejs.org/ and click install. ● Install the downloaded package. INSTALLING NODE.JS
  • 13. ● Hello World ● HTTP Server NODE.JS IN ACTION
  • 14. ● Routing support ● Template support ● Error handling ● Etc.
  • 15. EXPRESS TO RESCUE Web Application Framework for Node
  • 16. ● Install Express – npm install express -g ● Create a new Express application – express --sessions --ejs hello-world
  • 18. 18  Open Source NoSQL document datastore – JSON style documents  Schema-less – Each document is heterogeneous, and may have completely unique structure compared to other documents  Fast and horizontally scalable  Rich query language  Rich documents  Easy to get running  Geospatial indexing WHAT IS MONGODB
  • 19. Database → Database Table → Collection Row → Document Index → Index STEP 4 : MONGODB TERMINOLOGY
  • 21. 21  What is it for?  Find all the MongoDB jobs near me – Proximity Queries  Find all the MongoDB jobs within Bangalore – Bounded Queries  Find all the MongoDB job at this location – Exact Queries ● Supports only two dimensional indexes.  You can only have one geospatial index per collection.  By default, 2d geospatial indexes assume longitude and latitude have boundaries of -180 inclusive and 180 non-inclusive (i.e. [-180, 180)) GEOSPATIAL INDEXING BASICS
  • 22. 22 1) Put your coordinates into an array { loc : [ 50 , 30 ] } //SUGGESTED OPTION { loc : { x : 50 , y : 30 } } { loc : { foo : 50 , y : 30 } } 1) { loc : { lon : 40.739037, lat: 73.992964 } } 2) Make a 2d index db.places.ensureIndex( { loc : "2d" } ) 3) If you use latitude and longitude as your coordinate system, always store longitude first. MongoDB’s 2d spherical index operators only recognize [ longitude, latitude] ordering. HOW TO MAKE IT WORK
  • 24. LocalJobs : Location Aware Job Search App Functionalities or User stories or Features 1. As an Employer , I should be able to register my company 2. As an Employer, I should be able to post jobs 3. As a Job seeker , I should be able to register myself with application 4. As a Job seeker , I should be able to search jobs near to my current location. 5. As a Job seeker , I should be able to apply a job 6. Etc... APP -- USER STORIES
  • 25. Prioritize the functionalities or user stories or features – As an Employer, I should be able to post jobs – As a Job seeker , I should be able to search jobs near to my current location. – As a Job seeker , I should be able to see all the jobs PRIORITIZE
  • 26. $ git clone https://github.com/shekhargulati/localjobs-nodejs.git STEP 0 : CLONE REPO
  • 27. $ git checkout 380e795c9b52235838c361f9052f188e054c0ea8 $ npm install -l STEP 1 : APP INIT
  • 28. $ git checkout b721308a8945b28019731791a5a1188ba3d855b6 $ npm install -l STEP 2 : INDEX PAGE
  • 29. $ git checkout edbec3f6df758e6287f7c8ded6098ada9262282 $ npm install -l STEP 3 : SAVE JOB
  • 30. $ git checkout 457eb572b0d74c649b56c26306a1d5bcdd01a9e1 STEP 4 : VIEW ALL JOBS
  • 31. $ git checkout a9e50f4feb1448c924758ed968d8253da3c06070 Create MongoDB 2d Index STEP 5 : SEARCH BY NEAR
  • 32. $ git checkout 82a6cefe0514d1b81d0b8446412a16340465590d STEP 6 : SEARCH BY GEONEAR
  • 33. $ ./mongoimport --db localjobs --collection jobs –file jobs.json STEP 7 : IMPORT DATA
  • 35.
  • 36.
  • 37. PaaS == Platform as a Service A Cloud Application Platform Code Deploy Enjoy Save Time and Money Code your app Push-button Deploy, and your App is running in the Cloud!
  • 38. 38 OpenShift is PaaS by Red Hat Multi-language, Auto-Scaling, Self-service, Elastic, Cloud Application Platform
  • 40. 40 https://openshift.redhat.com/app/account/new Promo code is JSCHANNEL13 CREATING OPENSHIFT ACCOUNT
  • 41. ● Free! No time limit ● 3 gears (like servers) - each 512 Mb RAM, 1 Gb disk ● Auto-scaling ● Simple pricing BUT WAIT – THERE's MORE
  • 42. 42 rhc create-app localjobs nodejs mongodb-2.2 --from-code= https://github.com/shekhargulati/localjobs-nodejs.git Lot of other tasks you can do with rhc – tail log, app management, cartridge management , ssh management , namespace management, etc. Run rhc -h for details DEMO : LOCALJOBS APP RHC is only required for infrastructure tasks
  • 44. IN CASE YOU CARE • Shekhar Gulati – Works at Red Hat • Principal OpenShift Developer Evangelist • Java / Python/ JavaScript / NoSQL / Cloud Guy • Twitter Handle : shekhargulati • Github https://github.com/shekhargulati • Slides https://speakerdeck.com/shekhargulati