MongoDB
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,808
On Slideshare
3,806
From Embeds
2
Number of Embeds
1

Actions

Shares
Downloads
68
Comments
0
Likes
2

Embeds 2

http://www.slideshare.net 2

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

Transcript

  • 1. Document-Oriented Database
    John Sercel
  • 2. Document vs. Relational
    Relational database
    Tables -> Records
    Defined schema
    Document-oriented database
    Collections -> Documents
    No schema
    John Sercel | 2
  • 3. MongoDB
    • Language drivers
    C, C++, Java, Javascript, Perl, PHP, Python, Ruby, etc.
    OS Support
    OS X, Linux, Windows, Solaris
    Open Source, Free
    Support
    Community
    Commercial
    John Sercel | 3
  • 4. Installation: Windows, Linux
    • Quick, easy installation
    Download
    Unzip the archive file
    Create a data directory: /data/db (c:datadb)
    Start MongoDB Server
    ./bin/mongod[binmongod.exe]
    Start MongoDB Client
    ./bin/mongo [binmongo.exe]
    John Sercel | 4
  • 5. MongoDB Basics
    • Basic commands
    List databases: show dbs
    Select database: use [db name]
    Insert document
    db.myCollection.insert({‘myKey’ : ‘myValue’, ‘anotherKey’ : ‘anotherValue’ })
    John Sercel | 5
  • 6. MongoDB Basics
    • Select documents (MongoDB)
    db.myCollection.find()
    db.myCollection.find({‘name’ : ‘John Doe’})
    • Select documents (SQL)
    SELECT * FROM myTable
    SELECT * FROM myTable WHERE name = ‘John Doe’
    John Sercel | 6
  • 7. Connecting MongoDB: PHP
    • Install MongoDB PHP Extension
    Source, PHP Extension Community Library (PECL)
    Update configuration file
    Restart server software
    John Sercel | 7
  • 8. Connecting MongoDB: PHP
    • PHP Example
    Insert new document
    $connection = new Mongo();
    $collection = $connection->databaseName->collectionName;
    $document = array( "name" => “John Doe”);
    $collection->insert($document);
    Select document(s)
    $documents = $collection->find();
    John Sercel | 8
  • 9. Why Document-Oriented?
    • Storing unique documents
    Non-standard field set in each entity
    Speed vs. Normalization
    Normalization decreases redundancy, and speed.
    Relational operations are expensive
    Simple data storage preferable for heavy use
    BigTable, Cassandra
    John Sercel | 9
  • 10. References
    MongoDB. (2009a). Mongodb-10gen confluence website. Retrieved February 5, 2010 from http://www.mongodb.org/
    MongoDB. (2009b). Quickstart-mongodb. Retrieved February 8, 2010 from http://www.mongodb.org/display/DOCS/Quickstart /
    MongoDB. (2009c). Developer zone-mongodb. Retrieved February 8, 2010 from http://www.mongodb.org/display/DOCS/Developer+Zone/
    The PHP Group. (2009). Php manual-mongo. Retrieved February 5, 2010 from http://us3.php.net/manual/en/mongo.manual.php
    John Sercel | 10