introduction to mongodb
play

Introduction to MongoDB Kristina Chodorow kristina@mongodb.org - PowerPoint PPT Presentation

Introduction to MongoDB Kristina Chodorow kristina@mongodb.org Application PHP Apache Database Linux Application PHP IIS Windows Application PHP Apache Linux Application PHP Apache Linux Application PHP Apache Linux


  1. Introduction to MongoDB Kristina Chodorow kristina@mongodb.org

  2. Application PHP Apache Database Linux

  3. Application PHP IIS Windows

  4. Application PHP Apache Linux

  5. Application PHP Apache Linux

  6. Application PHP Apache Linux

  7. Application The world's most popular open source database PHP Apache Linux

  8. Application PHP Apache Linux The world's most advanced open source database

  9. server databases contain tables contain rows

  10. server schema databases contain tables contain rows

  11. server schema databases contain tables contain rows joins

  12. server schema databases contain tables contain rows joins

  13. Application Perl Apache Linux

  14. getting started

  15. www.mongodb.org

  16. $ mysqld

  17. $ mongod

  18. $ mysql

  19. $ mongo

  20. $ mongo MongoDB shell version 1.5.5 url: test connecting to: test type "help" for help >

  21. $ mongo MongoDB shell version 1.5.5 url: test connecting to: test type "help" for help > db

  22. $ mongo MongoDB shell version 1.5.5 url: test connecting to: test type "help" for help > db test >

  23. $ mongo MongoDB shell version 1.5.5 url: test connecting to: test type "help" for help > db test >

  24. $ mongo MongoDB shell version 1.5.5 url: test connecting to: test type "help" for help > db test > table = db.foo

  25. server

  26. server databases

  27. server databases contain tables

  28. server databases contain tables

  29. server databases contain tables

  30. server databases contain tables contain rows

  31. server databases contain tables contain rows

  32. server databases contain tables contain rows

  33. server schema databases contain tables contain rows

  34. server schema databases contain tables contain rows joins

  35. server databases contain collections contain documents

  36. $ mongo MongoDB shell version 1.5.5 url: test connecting to: test type "help" for help > db test > collection = db.foo

  37. $ mongo MongoDB shell version 1.5.5 url: test connecting to: test type "help" for help > db test > collection = db.foo

  38. > doc = { ... "name" : "kristina", ... "contact info" : { ... "twitter" : "@kchodorow", ... "email" : "kristina@10gen.com" ... }, ... "friends" : 400232, ... "pic" : BinData(...) ... "member since" : new Date()}

  39. > db.foo.insert(doc)

  40. > db.foo.findOne({"name" : "kristina"});

  41. > db.foo.findOne({"name" : "kristina"}) > db.foo.findOne({ ... "contact.twitter" : "@kchodorow"})

  42. > db.foo.findOne({"name" : "kristina"}) > db.foo.findOne({ ... "contact.twitter" : "@kchodorow"}) > db.foo.find({ ... "member since" : { ... "$gt" : yesterday, ... "$lt" : today ... }})

  43. > db.foo.findOne({"name" : "kristina"}) > db.foo.findOne({ ... "contact.twitter" : "@kchodorow"}) > db.foo.find({ ... "member since" : { ... "$gt" : yesterday, ... "$lt" : today ... }}).sort({friends : 1}).limit(10). ... skip(100)

  44. db.people.update( {name : "kristina"},

  45. db.people.update( {name : "kristina"}, {$set :

  46. db.people.update( {name : "kristina"}, {$set : {"contact.website" : "snailinaturtleneck.com" }});

  47. > db.pageviews.update( {url : "example.com"}, {$inc : {pageviews : 1}}, true)

  48. some features

  49. I suddenly have a deep love for stored procedures

  50. I suddenly have a deep love for stored procedures

  51. > db.system.js.insert({ "_id" : "x", "value" : 3}); > db.system.js.insert({ "_id" : "y", "value" : 4}); > db.eval("return x+y")

  52. > db.system.js.insert({_id : "log", ... value : function(msg, level) { ... var date = "[" + new Date() + "] "; ... var lvl = level ? level+" " : ""; ... print(date + lvl + msg); ... }})

  53. > db.eval("log('all your base are belong to us', 'FATAL');");

  54. > db.eval("log('all your base are belong to us', 'FATAL');"); [Fri May 19 18:34:57] FATAL all your base are belong to us

  55. J J J J J J J J J

  56. capped collections

  57. indexes

  58. geospatial indexes

  59. MapReduce

  60. what did we leave out?

  61. I say, we should get a mainframe, old chap. Harumph.

  62. are you practicing safe data storage?

  63. Insert this. Okay, got it. Phew, my data's safe.

  64. Write this to disk I know better than he does, I'll just let this sit in a buffer for a while. All over it!

  65. ? I have no idea what you're talking about.

  66. trust no one! ...trust a bunch of ones. Mostly.

  67. prod1.example.com prod2.example.com

  68. prod1.example.com prod2.example.com

  69. prod1.example.com prod2.example.com

  70. prod2.example.com prod1.example.com

  71. prod1.example.com prod2.example.com

  72. prod1.example.com prod2.example.com

  73. prod1.example.com ? prod2.example.com

  74. prod1.example.com prod2.example.com

  75. ? prod1.example.com prod2.example.com

  76. prod1.example.com prod2.example.com

  77. prod1.example.com prod2.example.com

  78. primary secondary secondary passive

  79. My priority is 2 My priority is 1 secondary secondary passive

  80. primary secondary passive

  81. I'm 5 minutes behind the master I'm 3 seconds behind the master secondary secondary passive

Recommend


More recommend