Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MongoLab Hackathon QuickStart

Ben Wen
November 09, 2012

MongoLab Hackathon QuickStart

How to use MongoLab for your Hackathon project. Includes instructions to use our REST API and pointers to other tools for rapid development.

Ben Wen

November 09, 2012
Tweet

More Decks by Ben Wen

Other Decks in Programming

Transcript

  1. Hackathon QuickStart Ben Wen [email protected] @mongolab Node Knockout 2012 Build

    More. Worry Less. tl;dr version: 1. [sudo] npm update -g jitsu 2. jitsu databases create mongo
  2. what is MongoLab? •  Cloud hosted MongoDB-as-a-Service •  In Joyent

    Cloud (and Amazon EC2, Rackspace or Azure) •  replication, backups, monitoring •  500MB free plan and multi-tenant for-pay plans •  dedicated server plan •  awesome admin tools •  REST API •  Quickstart: http://bit.ly/hackmongo
  3. what is MongoDB? an awesome JSON object store ! !

    ! ! { “firstName” : “Ben”,! “lastName” : “Wen”,! “email” : “[email protected]”,! “location” : { “lat” : 37.41, “long” : -122.05 },! “hobbies” : [ “music”, “biking”, “foto” ] }! http://mongodb.org
  4. I’ve written my mobile app / realtime web app /

    API where should I store my data ? ?
  5. MongoLab cloud database: Node.js native, Mongoose ODM, and REST API

    •  Standardized, well-known JSON interface •  High performance in Joyent Cloud •  Also a REST API with CRUD semantics REST API mongodb mongolab service Node.js native, or Mongoose ODM Mongodb driver
  6. many use cases of simple cloud db storage needs • logging

    • user profile data • game data (stats, high scores) • polls and surveys • user feedback • geo database
  7. /databases/<d>/collections! GET! ! /databases/<d>/collections/<c>! GET ! POST! ! /databases/<d>/collections/<c>/<_id>! GET

    ! PUT! DELETE! ! /databases/<d>/collections/<c>?[q=<query>]! [&f=<fields>]! [&s=<order>]! [&sk=<skip>]! [&l=<limit>]! GET! MongoLab’s REST API
  8. MongoLab API Example •  POST ! URL: https://mongolab.com/api/1/databases/demo/collections/geoposts! ! Data:

    { “email” : “[email protected]”,! ! “date” : { “$date” : “2010-12-03 11:18:21 UTC” },! “location” : { “lat” : 37.41, “long” : -122.05 },! ! “message” : “Hello Seattle!” }! ! • GET URL: https://…/geoposts?q={"location":{"$near":{"lat":37,"long":-122}}} !
  9. Next Steps 1.  http://bit.ly/hackmongo - this presentation 2.  [sudo] npm

    update -g jitsu; jitsu databases create mongo 3.  Alternate Node Knockout instructions, with Web UI and more tutorials: http://blog.nodeknockout.com/post/ 35339780516/mongolabs-joyent-hosted- mongodb-quick-start 4.  Design, code, debug, repeat