Introducing
MongoDB is... <ul><li>Document oriented, schema-free database
Built for performance
Built to scale </li></ul>
Document Oriented <ul>Collections = Tables Documents = Rows </ul>
{ &quot;name&quot;  :  &quot;MongoDB&quot; , &quot;type&quot;  :  &quot;database&quot; , &quot;count&quot;  : 1, &quot;inf...
Built for performance <ul><li>No transactions (for now)
Fast, in-place updates
Supports indexing </li></ul>
Built to Scale
Sharding
Code examples...
Mongo mongo =  new  Mongo(  new  DBAddress(  &quot;localhost&quot; , 27017 ) ); DB db = mongo.getDB(  &quot;mydb &quot; );...
BasicDBObject doc =  new  BasicDBObject(); doc.put( &quot;name&quot; ,  &quot;Thinkorswim&quot; ); doc.put( &quot;address&...
DBCursor cursor = collection.find( new  BasicDBObject( &quot;name&quot; ,  “Thinkorswim” )); while (cursor.hasNext()){ Sys...
Upcoming SlideShare
Loading in...5
×

MongoDB Thinkorswim

1,289

Published on

MongoDB presentation for Thinkorswim

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,289
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

MongoDB Thinkorswim

  1. 1. Introducing
  2. 2. MongoDB is... <ul><li>Document oriented, schema-free database
  3. 3. Built for performance
  4. 4. Built to scale </li></ul>
  5. 5. Document Oriented <ul>Collections = Tables Documents = Rows </ul>
  6. 6. { &quot;name&quot; : &quot;MongoDB&quot; , &quot;type&quot; : &quot;database&quot; , &quot;count&quot; : 1, &quot;info&quot; : { x : 203, y : 102 } }
  7. 7. Built for performance <ul><li>No transactions (for now)
  8. 8. Fast, in-place updates
  9. 9. Supports indexing </li></ul>
  10. 10. Built to Scale
  11. 11. Sharding
  12. 12. Code examples...
  13. 13. Mongo mongo = new Mongo( new DBAddress( &quot;localhost&quot; , 27017 ) ); DB db = mongo.getDB( &quot;mydb &quot; ); DBCollection collection = db.getCollection( &quot;test&quot; ); Getting connected
  14. 14. BasicDBObject doc = new BasicDBObject(); doc.put( &quot;name&quot; , &quot;Thinkorswim&quot; ); doc.put( &quot;address&quot; , &quot;600 W. Chicago Ave., #100&quot; ); doc.put( &quot;count&quot; , 1); BasicDBObject loc = new BasicDBObject(); info.put( &quot;lat&quot; , 41.896551); info.put( &quot;long&quot; , -87.643438); doc.put(&quot;loc&quot;, loc); coll.insert(doc);
  15. 15. DBCursor cursor = collection.find( new BasicDBObject( &quot;name&quot; , “Thinkorswim” )); while (cursor.hasNext()){ System.out.println(cursor.next().get( &quot;name&quot; ); } Querying
  16. 16. Updates and Operators <ul><li>* $inc
  17. 17. * $set
  18. 18. * $unset
  19. 19. * $push
  20. 20. * $pushAll </li></ul><ul><li>* $addToSet
  21. 21. * $pop
  22. 22. * $pull
  23. 23. * $pullAll
  24. 24. * $rename </li></ul>
  25. 25. BasicDBObject inc = new BasicDBObject( &quot;$inc&quot; , new B asicDBObject( &quot;count&quot; , 1)); BasicDBObject spec = new BasicDBObject( “name” , ”Thinkorswim” ); collection.update(spec, inc);
  26. 26. Indexes Basic: coll.createIndex(new BasicDBObject( &quot;name&quot; , 1)); Embedded: coll.createIndex(new BasicDBObject( &quot;address.city&quot; , 1)); Compound: coll.createIndex(new BasicDBObject(“name”, 1).append( “i”, -1));
  27. 27. Even more... <ul><li>GridFS
  28. 28. MapReduce
  29. 29. Geospatial indexing </li></ul>

×