#The code to accompany the Spatial Node Mongo blog piece
This code actually belongs to a blog piece written on OpenShift.com
========
Create an account at http://openshift.redhat.com/
Create a Node.js application with MongoDB
rhc app create nodews nodejs-0.6 mongodb-2
Add this upstream flask repo
cd nodews
git remote add upstream -m master https://github.com/openshift/openshift-mongo-node-express-example.git
git pull -s recursive -X theirs upstream master
Then push the repo upstream
git push
Now, ssh into the application.
Add the data to a collection called parkpoints:
mongoimport -d nodews -c parkpoints --type json --file $OPENSHIFT_REPO_DIR/parkcoord.json -h $OPENSHIFT_MONGODB_DB_HOST -u admin -p $OPENSHIFT_MONGODB_DB_PASSWORD
Create the spatial index on the documents:
mongo
use nodews
db.parkpoints.ensureIndex( { pos : "2d" } );
Once the data is imported you can now checkout your application at:
http://nodews-$yournamespace.rhcloud.com/ws/parks
This code is dedicated to the public domain to the maximum extent permitted by applicable law, pursuant to CC0 http://creativecommons.org/publicdomain/zero/1.0/