Your SlideShare is downloading. ×
Mongodb - drupal dev days
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Mongodb - drupal dev days

3,295

Published on

Introduction to NoSql principles and MongoDB.

Introduction to NoSql principles and MongoDB.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,295
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
43
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Who has heard about nosql?Knows?Opinions?Against SQL? Hell no
  • Nothing NewBut wth is happening since 2000 (1st real end of the world, next is in 2038)?
  • Who cares about what is in that cloud?
  • Up to 40 indexes
  • No Op(yet)
  • Noop yet
  • Noop yet
  • Transcript

    • 1. Pierre Joye
      PHP Core Developer
      Microsoft - Open Source Tech Center
      @pierrejoye
    • 2. NoSQL?
      /(no)?SQL/
    • 3. Original diagram by Simon Munro (@simonmunron)
    • 4. Non Sql Databases
      Key-value cache
      Memcached, velocity, apc, wincache
      Key-value store
      Keyspace, Azure table
      eventually-consistentkey-value store
      Voldemort, SimpleDB
      document store
      MongoDB, CouchDB, Riak
      wide columnar store
      BigTable, Hbase, Cassandra, Qbase, Hypertable
      Graph database
      Neo4j
    • 5. A NEW WAY
    • 6. Know your environment
    • 7. DBs
      SQL
      Soap
      Apps
      Apps
      IO
      Key/val
      Cache
      Files
    • 8. Data Cloud
      Apps
      Objects
    • 9. RDBMs
      Apps
      Objects
      NoSql
    • 10. Scalable, High-Performance, Open Source, Document-Oriented Database(and schema-free)
    • 11. and me
      Production Deployments
      More at http://www.mongodb.org/display/DOCS/Production+Deployments
    • 12. Support and Resources
      http://www.mongodb.org
      IRC Freenode #mongodb
      http://groups.google.com/group/mongodb-user
      @mongodb
    • 13.
    • 14. Database
    • 15. Collection
    • 16. Documents
      http://www.flickr.com/photos/critter_lm/199190303/
    • 17. Index
    • 18.
    • Types
      JSON Types
      Null
      Boolean
      Integer
      Long
      Double
      String
      Array
      Object
      BSON Types
      Object id
      Date
      Binary data
      Regular expression
      Code
      Max value
      Min value
      +
    • 26. Demos
    • 27. Setup
    • 28. Representations
    • 29. Connect to MongoDB
      $connection = new Mongo( “localhost:9000" ); 
    • 30. Create a database
      $c = new Mongo( “localhost:9000" ); 
      $db = $c->db2;
    • 31. Create a database
      $c = new Mongo( “localhost:9000" ); 
      $db = $c->db1;
    • 32. Get a Collection
      $conn = new Mongo( "localhost:9000" );
      $db = $conn->db1;
      $collection = $db->user;
      Or
      $collection = $conn->db1->user;
    • 33. Create a Document
      $conn = new Mongo( "localhost:9000" );
      $c = $conn->db1->user;
      $user = array(
      'name' => 'John',
      'age' => 32);
      $c->save($user);
    • 34. Query a Document
      $conn = new Mongo( "localhost:9000" );
      $c = $conn->db1->user;
      $obj = $c->findOne();
      echo "Created on: " . date(DATE_RFC822,
      $obj['_id']->getTimeStamp()) . " ";
    • 35. Update a Document
      <?php
      $conn = new Mongo( "localhost:9000" );
      $c = $conn->db1->user;
      $c->update(
      array('name' => 'John'),
      array('name' => '',
      'age' => 34,
      'city' => 'Munich')
      );
    • 36. Find doc w/o a field
      <?php
      $conn = new Mongo( "localhost:9000" );
      $c = $conn->db1->user;
      $cursor = $c->find(array('city' =>
      array('$exists' => 0)
      )
      );
      echo "Found: " . $cursor->count() . " ";
    • 37. Create Index
      <?php
      $conn = new Mongo( "localhost:9000" );
      $c = $conn->db1->user;
      $c->ensureIndex(array('age' => 1));
      $cursor = $c->find(array('age' =>
      array( '$gt' => 34, '$lt' => 53 )));

    ×