Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

MongoDB - javascript for your data

on

  • 8,560 views

An intro to MongoDB

An intro to MongoDB

Statistics

Views

Total Views
8,560
Views on SlideShare
8,539
Embed Views
21

Actions

Likes
11
Downloads
335
Comments
0

1 Embed 21

http://www.scoop.it 21

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    MongoDB - javascript for your data MongoDB - javascript for your data Presentation Transcript

    • javascript for your data
    • MongoDB Bridge the gap between key/val stores and traditional RDBMS
    • MongoDB Bridge the gap between key/val stores and traditional RDBMS
    • MongoDB the gap
      • table
    • MongoDB the gap
      • table -> collection
    • MongoDB collection
    • MongoDB collection
      • BSON document
    • MongoDB collection
      • BSON document
        • a set of fields
    • MongoDB collection
      • BSON document
        • a set of fields
          • key-value pair
    • MongoDB collection
      • BSON document
        • a set of fields
          • key-value pair
            • key: a name (string)
    • MongoDB collection
      • BSON document
        • a set of fields
          • key-value pair
            • key: a name (string)
            • val: any basic type
              • string, int, float, date, binary, array, document, ...
    • MongoDB collection
      • BSON document
        • db.users
        • db.products
        • db.barbieDollsYouHideFromYourFriends
    • MongoDB collection
      • of BSON documents
      • queryable
    • MongoDB the gap
      • table -> collection
      • SQL
    • MongoDB the gap
      • table -> collection
      • SQL -> query objects
    • MongoDB Query object
    • MongoDB Query object
      • JSON-like query representation
    • MongoDB Query object
      • JSON-like query representation
      • db.users.find( { 'lastname': 'Heckmann' } );
    • MongoDB Query object { 'lastname': 'Heckmann' }
    • MongoDB Query object { 'lastname': 'Heckmann' } could even be an array
    • MongoDB Query object { 'lastname': 'Heckmann' , 'body.odor': 'nasty' , 'age': { $gt: 32 } , ... }
    • MongoDB Query object { 'lastname': 'Heckmann' , 'body.odor' : 'nasty' , 'age': { $gt: 32 } , ... }
    • MongoDB Query object { 'lastname': 'Heckmann' , 'body.odor': 'nasty' , 'age': { $gt: 32 } , ... }
    • MongoDB Query object { 'lastname': 'Heckmann' , 'body.odor': 'nasty' , 'age': { $gt: 32, $lt: 65 } , ... }
    • MongoDB Query object $gt $lt $ne $in $nin $all $not $size $exists … more
    • MongoDB Query object RegExp too!
    • MongoDB Query object RegExp too db.users.find({ 'lastname': / eckmann $/i });
    • MongoDB Query object Subsets db.users.find({ 'lastname': /eckmann$/i }, { 'age': true } );
    • MongoDB Query object db.users .find({ 'lastname': /eckmann$/i }) . sort ({ 'lastname': -1 }) . limit (10) . skip (10*(pageNumber - 1)) ;
    • MongoDB Query object db.users .find({ 'lastname': /eckmann$/i }) . sort({ 'lastname': -1 }) ← descending .limit(10) .skip(10*(pageNumber - 1)) ;
    • MongoDB Query object db.users .find({ 'lastname': /eckmann$/i }) . count() ;
    • MongoDB
      • no JOINs
    • MongoDB
      • no JOINs
      • less normalization
    • MongoDB
      • no JOINs
      • less normalization
      • embedded documents
    • MongoDB embedded documents
    • MongoDB embedded documents { name: 'aaron' , scores: [ { total: 93, class: ObjectID } , { total: 46, class: ObjectID } , { total: 20, class: ObjectID } ] }
    • MongoDB embedded documents { name: 'aaron' , scores: [ { total: 93, class: ObjectID } , { total: 46, class: ObjectID } , { total: 20, class: ObjectID } ] } think foreign keys
    • MongoDB embedded documents { name: 'aaron' , scores: [ { total: 93, class: ObjectID } , { total: 46, class: ObjectID } , { total: 20, class: ObjectID } ] } { _id: ObjectID , name: 'how to be a good neighbor' , teacher: 'mr rogers' }
    • MongoDB ObjectID
      • unique identifier of a document
      • each document has one
      • auto inserted if missing
    • MongoDB Insertion and Updation
    • MongoDB
    • cheesy
    • Atomic Operations
    • MongoDB $set $unset $inc $push $pushAll $pop $pull $pullAll $addToSet $rename Atomic Ops
    • MongoDB Indexing
    • MongoDB Indexing
      • any property
      • into embedded documents
      • into arrays
    • MongoDB Indexing db.users.ensureIndex({ lastname: 1 }) db.users.ensureIndex({ 'body.odor': 1 }) db.users.ensureIndex({ 'body.odor': 1, age: 1 })
    • MongoDB HTTP Interface
    • MongoDB HTTP Interface
      • http://localhost:28017/
      • http://localhost:28017/database/collection/?limit=5
      • http://localhost:28017/database/collection/?filter_key=value
    • MongoDB
      • Document oriented
      • Schema-less
      • Rich queries
      • Full index support
      • Atomic operations
      • MapReduce
      • Auto-sharding / replication / GridFS
    • MongoDB Mongoose
      • https://github.com/learnboost/mongoose/tree/1.0
    • Thank You http://www.mongodb.org https://github.com/mongodb https://github.com/learnboost/mongoose https://github.com/christkv/node-mongodb-native http://www.mongodb.org/display/DOCS/Production+Deployments https://github.com/aheckmann http://twitter.com/#!/aaronheckmann