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

introtomongodb-100223125714-phpapp01.pdf

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →
Avatar for agnivade agnivade
April 09, 2012
33

 introtomongodb-100223125714-phpapp01.pdf

Avatar for agnivade

agnivade

April 09, 2012

Transcript

  1. MongoDB (from "humongous") is a scalable, high-performance, open source, schema-free,

    document-oriented database. - mongodb.org Monday, February 22, 2010
  2. Philosophy DBs should be an on-demand commodity, in a cloud-

    like fashion Monday, February 22, 2010
  3. Philosophy Mongo tries to achieve the performance of traditional key-value

    stores while maintaining functionality of traditional RDBMS Monday, February 22, 2010
  4. This is extremely powerful, b/c it means mongo understands JSON

    natively Features: Document Storage Monday, February 22, 2010
  5. Any valid JSON can be easily imported and queried Features:

    Document Storage Monday, February 22, 2010
  6. Features: Querying Rich, javascript-based query syntax Allows us to do

    deep, nested queries db.order.find( { shipping: { carrier: "usps" } } ); Monday, February 22, 2010
  7. Features: Querying Rich, javascript-based query syntax Allows us to deep,

    nested queries db.order.find( { shipping: { carrier: "usps" } } ); shipping is an embedded document (object) Monday, February 22, 2010
  8. Efficient binary large object store via GridFS i.e. store images,

    videos, anything Features: Binary Object Store Monday, February 22, 2010
  9. Concepts: Document-oriented Think of “documents” as database records Documents are

    basically just JSON objects that Mongo stores in binary Monday, February 22, 2010
  10. RDBMS (mysql, postgres) MongoDB Tables Collections Records/rows Documents/objects Queries return

    record(s) Queries return a cursor Concept Mapping Monday, February 22, 2010
  11. RDBMS (mysql, postgres) MongoDB Tables Collections Records/rows Documents/objects Queries return

    record(s) Queries return a cursor Concept Mapping ??? Monday, February 22, 2010
  12. Concepts: Cursors Queries return “cursors” instead of collections A cursor

    allows you to iterate through the result set Monday, February 22, 2010
  13. Concepts: Cursors Queries return “cursors” instead of collections A cursor

    allows you to iterate through the result set A big reason for this is performance Monday, February 22, 2010
  14. Concepts: Cursors Queries return “cursors” instead of collections A cursor

    allows you to iterate through the result set A big reason for this is performance Much more efficient than loading all objects into memory Monday, February 22, 2010
  15. Concepts: Cursors The find() function returns a cursor object var

    cursor = db.logged_requests.find({ 'status_code' : 200 }) cursor.hasNext() // "true" cursor.forEach( function(item) { print(tojson(item)) } ); cursor.hasNext() // "false" Monday, February 22, 2010
  16. Cool Features Capped collections Fixed-sized, limited operation, auto-LRU age-out collections

    Fixed insertion order Super fast Ideal for logging and caching Monday, February 22, 2010
  17. Cool Uses Data Warehouse Mongo understands JSON natively Very powerful

    for analysis Query a bunch of data from some web service Monday, February 22, 2010
  18. Cool Uses Data Warehouse Mongo understands JSON natively Very powerful

    for analysis Query a bunch of data from some web service Import into mongo (mongoimport -f filename.json) Monday, February 22, 2010
  19. Cool Uses Data Warehouse Mongo understands JSON natively Very powerful

    for analysis Query a bunch of data from some web service Import into mongo (mongoimport -f filename.json) Analyze to your heart’s content Monday, February 22, 2010