SlideShare a Scribd company logo
1   #commands for adding spatial data!
 2   !
 3   #Take a look at the file first!
 4   less parkcoord.json!
 5   #get the file on the server!
 6   scp parkcoord.json 0b49d9219f2847c6a236820959f9a@parks-spmongo.rhcloud.com:parks/data/!
 7   !
 8   #ssh into the machine!
 9   ssh 0b49d9219f2847c6a236820959f9a@parks-spmongo.rhcloud.com!
10   !
11   #import into mongo!
12   mongoimport -d parks -c mongosf --type json --file parks/data/parkcoord.json -h $OPENSHIFT_NOSQL_DB_HOST -u admin -p <your
 …   password>!
13   !
14   #open the mongo shell!
15   mongo -u admin -p <your password> $OPENSHIFT_NOSQL_DB_HOST/parks!
16   !
17   #build the index!
18   db.mongosf.ensureIndex({"pos":"2d"});!
19   !
20   #Now some queries!
21   #simple spatial!
22   db.mongosf.find({"pos" : { "$near" : [-37, 41]}});!
23   !
24   #spatial and text query using regex!
25   db.mongosf.find( { Name : /lincoln/i, pos : { $near : [-37,41] }} );!
26   !
27   #geonear TODO!
28   db.runCommand({ geoNear : "mongosf", near : [-37,41], num : 10 });!
29   !
30   !
31   #create a new collection from scratch!
32   db.createCollection("mongosfuserloc");!
33   db.mongosfuserloc.ensureIndex( { pos : "2d" } );!
34   !
35   #insert a new record!
36   db.mongosfuserloc.insert({ "created" : new Date(), "Notes" : 'just landed', "pos" : [-76.7302 , 25.5332 ] })!
37   !   !
38   #quick query to make sure it worked!
39   db.mongosfuserloc.find( { pos : { $near : [-37,41] } } )!
40   !
41   #add a second document closer to query point!
42   #this is an upsert - since we don't pass in the _id it creates a new record!
43   db.mongosfuserloc.save({ created : new Date(), Notes: 'that was a big step', pos : [-37.7302 , 40.5332 ]});!
44   !
45   #one way to update original document!
46   myDoc = db.mongosfuserloc.findOne({_id : ObjectId("ID for the first object")});!
47   myDoc.Notes = "really the landing";!
48   db.mongosfuserloc.save(myDoc);!
49

More Related Content

PPTX
Spatial MongoDB, Node.JS, and Express - server-side JS for your application
PPTX
Spatial Mongo and Node.JS on Openshift JS.Everywhere 2012
PPTX
Spatial mongo for PHP and Zend
PDF
Script for the geomeetup presentation
PPT
Mongo sf spatialmongo
PPT
Openshift GeoSpatial Capabilities
PPTX
OpenShift with Eclipse Tooling - EclipseCon 2012
PPTX
Free Mongo on OpenShift
Spatial MongoDB, Node.JS, and Express - server-side JS for your application
Spatial Mongo and Node.JS on Openshift JS.Everywhere 2012
Spatial mongo for PHP and Zend
Script for the geomeetup presentation
Mongo sf spatialmongo
Openshift GeoSpatial Capabilities
OpenShift with Eclipse Tooling - EclipseCon 2012
Free Mongo on OpenShift

What's hot (20)

PDF
Spatial script for my JS.Everywhere 2012
PPTX
Bringing Spatial Love to Your Java Application
PPTX
Back to Basics German 3: Einführung in Replica Sets
PDF
faastCrystal
PDF
Introduction to Hadoop - FinistJug
PPT
Installation of application server 10g in red hat 4
PDF
Ruby on embedded devices rug::b Aug 2014
PPTX
Python Dependencies at Beeswax - BazelCon 2019 Lightning Talk - Ron Rothman
PDF
Redis clustering
PDF
Infrastructure coders logstash
PDF
Cloud Firestore – From JSON Deserialization to Object Document Mapping (ODM)
PDF
Datafying Bitcoins
PDF
Make the prompt great again
PDF
Build, Ship, and Run Any App, Anywhere using Docker
PPTX
MessagePack - An efficient binary serialization format
PDF
Kubernetes - Parte I
PDF
Hadoop con2016 - Implement Real-time Centralized logging System by Elastic Stack
PPTX
How To Run Mapreduce Jobs In Python
PDF
OSS AWS 핸즈온 강의
PDF
MongoDB 3.0.0 vs 2.6.x vs 2.4.x Benchmark
Spatial script for my JS.Everywhere 2012
Bringing Spatial Love to Your Java Application
Back to Basics German 3: Einführung in Replica Sets
faastCrystal
Introduction to Hadoop - FinistJug
Installation of application server 10g in red hat 4
Ruby on embedded devices rug::b Aug 2014
Python Dependencies at Beeswax - BazelCon 2019 Lightning Talk - Ron Rothman
Redis clustering
Infrastructure coders logstash
Cloud Firestore – From JSON Deserialization to Object Document Mapping (ODM)
Datafying Bitcoins
Make the prompt great again
Build, Ship, and Run Any App, Anywhere using Docker
MessagePack - An efficient binary serialization format
Kubernetes - Parte I
Hadoop con2016 - Implement Real-time Centralized logging System by Elastic Stack
How To Run Mapreduce Jobs In Python
OSS AWS 핸즈온 강의
MongoDB 3.0.0 vs 2.6.x vs 2.4.x Benchmark
Ad

Viewers also liked (7)

PPT
Overview Study on PIC32MX3XX / 4XX 32-Bit Controller
PDF
Rio negro instructivo para presidentes_de_mesa_elecciones_14-06-2015
PPSX
Curso de alisado brasileño
PPTX
Monitor slideshow
PPTX
Trabajo vanesaa beltran
PDF
Np presentación lotus exige gt
PPSX
Proyecto final productos - sede chitre
Overview Study on PIC32MX3XX / 4XX 32-Bit Controller
Rio negro instructivo para presidentes_de_mesa_elecciones_14-06-2015
Curso de alisado brasileño
Monitor slideshow
Trabajo vanesaa beltran
Np presentación lotus exige gt
Proyecto final productos - sede chitre
Ad

Similar to MongoSF - Spatial MongoDB in OpenShift - script file (20)

PDF
Spatial script for Spatial mongo for PHP and Zend
PDF
Script for Spatial Mongo
PDF
Spatial script for CIMA
PPTX
Getting Started with Geospatial Data in MongoDB
PDF
MongoDB全機能解説2
ODT
Spatial script for MongoBoulder
PDF
Geospatial Enhancements in MongoDB 2.4
PPTX
MongoDB GeoSpatial Feature
KEY
Geospatial Indexing and Querying with MongoDB
PPTX
Open Source Mapping with Python, and MongoDB
PDF
Geospatial and MongoDB
PPTX
Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...
PPTX
Geoindexing with MongoDB
PDF
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
PPT
Building web applications with mongo db presentation
KEY
Building Your First MongoDB Application
PPTX
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
PDF
mongodb-introduction
PDF
A Century Of Weather Data - Midwest.io
PPT
9b. Document-Oriented Databases lab
Spatial script for Spatial mongo for PHP and Zend
Script for Spatial Mongo
Spatial script for CIMA
Getting Started with Geospatial Data in MongoDB
MongoDB全機能解説2
Spatial script for MongoBoulder
Geospatial Enhancements in MongoDB 2.4
MongoDB GeoSpatial Feature
Geospatial Indexing and Querying with MongoDB
Open Source Mapping with Python, and MongoDB
Geospatial and MongoDB
Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...
Geoindexing with MongoDB
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
Building web applications with mongo db presentation
Building Your First MongoDB Application
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
mongodb-introduction
A Century Of Weather Data - Midwest.io
9b. Document-Oriented Databases lab

More from Steven Pousty (12)

PPTX
APPLICATIONS AND CONTAINERS AT SCALE: OpenShift + Kubernetes + Docker
PDF
Introduction to PaaS for application developers
PDF
London Cloud Summit 2014 - raising the tide: getting developers in the cloud
PPT
Workshop For pycon13
ODP
Build a PaaS with OpenShift Origin
PPTX
Monkigras - dropping science on your developer ecosystem
PPTX
Dropping Science on Your Developer Ecosystem - lessons from Ecosystem Management
PDF
Open shift intro for Philly PUG
PPT
Open shift intro for Philly PUG
PPTX
deCarta at BAPI
PPT
LinuxFest NW - Using Postgis To Add Some Spatial Flavor To Your App
PPT
Using PostGIS To Add Some Spatial Flavor To Your Application
APPLICATIONS AND CONTAINERS AT SCALE: OpenShift + Kubernetes + Docker
Introduction to PaaS for application developers
London Cloud Summit 2014 - raising the tide: getting developers in the cloud
Workshop For pycon13
Build a PaaS with OpenShift Origin
Monkigras - dropping science on your developer ecosystem
Dropping Science on Your Developer Ecosystem - lessons from Ecosystem Management
Open shift intro for Philly PUG
Open shift intro for Philly PUG
deCarta at BAPI
LinuxFest NW - Using Postgis To Add Some Spatial Flavor To Your App
Using PostGIS To Add Some Spatial Flavor To Your Application

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
cuic standard and advanced reporting.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
KodekX | Application Modernization Development
PDF
Approach and Philosophy of On baking technology
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Modernizing your data center with Dell and AMD
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Cloud computing and distributed systems.
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation theory and applications.pdf
Empathic Computing: Creating Shared Understanding
cuic standard and advanced reporting.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
MYSQL Presentation for SQL database connectivity
Advanced methodologies resolving dimensionality complications for autism neur...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Spectral efficient network and resource selection model in 5G networks
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
A Presentation on Artificial Intelligence
KodekX | Application Modernization Development
Approach and Philosophy of On baking technology
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Network Security Unit 5.pdf for BCA BBA.
Modernizing your data center with Dell and AMD
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Cloud computing and distributed systems.
“AI and Expert System Decision Support & Business Intelligence Systems”

MongoSF - Spatial MongoDB in OpenShift - script file

  • 1. 1 #commands for adding spatial data! 2 ! 3 #Take a look at the file first! 4 less parkcoord.json! 5 #get the file on the server! 6 scp parkcoord.json 0b49d9219f2847c6a236820959f9a@parks-spmongo.rhcloud.com:parks/data/! 7 ! 8 #ssh into the machine! 9 ssh 0b49d9219f2847c6a236820959f9a@parks-spmongo.rhcloud.com! 10 ! 11 #import into mongo! 12 mongoimport -d parks -c mongosf --type json --file parks/data/parkcoord.json -h $OPENSHIFT_NOSQL_DB_HOST -u admin -p <your … password>! 13 ! 14 #open the mongo shell! 15 mongo -u admin -p <your password> $OPENSHIFT_NOSQL_DB_HOST/parks! 16 ! 17 #build the index! 18 db.mongosf.ensureIndex({"pos":"2d"});! 19 ! 20 #Now some queries! 21 #simple spatial! 22 db.mongosf.find({"pos" : { "$near" : [-37, 41]}});! 23 ! 24 #spatial and text query using regex! 25 db.mongosf.find( { Name : /lincoln/i, pos : { $near : [-37,41] }} );! 26 ! 27 #geonear TODO! 28 db.runCommand({ geoNear : "mongosf", near : [-37,41], num : 10 });! 29 ! 30 ! 31 #create a new collection from scratch! 32 db.createCollection("mongosfuserloc");! 33 db.mongosfuserloc.ensureIndex( { pos : "2d" } );! 34 ! 35 #insert a new record! 36 db.mongosfuserloc.insert({ "created" : new Date(), "Notes" : 'just landed', "pos" : [-76.7302 , 25.5332 ] })! 37 ! ! 38 #quick query to make sure it worked! 39 db.mongosfuserloc.find( { pos : { $near : [-37,41] } } )! 40 ! 41 #add a second document closer to query point! 42 #this is an upsert - since we don't pass in the _id it creates a new record! 43 db.mongosfuserloc.save({ created : new Date(), Notes: 'that was a big step', pos : [-37.7302 , 40.5332 ]});! 44 ! 45 #one way to update original document! 46 myDoc = db.mongosfuserloc.findOne({_id : ObjectId("ID for the first object")});! 47 myDoc.Notes = "really the landing";! 48 db.mongosfuserloc.save(myDoc);! 49