PageRenderTime 58ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/bookmarks.js

https://github.com/saquib2527/notes
JavaScript | 135 lines | 132 code | 3 blank | 0 comment | 4 complexity | 5c30fb06bbe19beda9404cf95929b34f MD5 | raw file
  1. db.users.drop()
  2. db.links.drop()
  3. db.users.insert({
  4. name: { first: "John", last: "Doe" },
  5. age: 30,
  6. email: "johndoe@gmail.com",
  7. passwordHash: "some_password_hash",
  8. logins: [
  9. { at: new Date(2012, 3, 4, 5, 6, 7), minutes: 20 },
  10. { at: new Date(2012, 3, 15, 16, 17, 18), minutes: 18 },
  11. { at: new Date(2012, 4, 1, 2, 3, 4), minutes: 34 },
  12. ]
  13. });
  14. db.users.insert({
  15. name: { first: "Jane", last: "Wilson" },
  16. age: 25,
  17. email: "janewilson@gmail.com",
  18. passwordHash: "another_password_hash",
  19. logins: [
  20. { at: new Date(2012, 5, 6, 7, 8, 9), minutes: 21 },
  21. { at: new Date(2012, 5, 16, 17, 18, 19), minutes: 50 }
  22. ]
  23. });
  24. db.users.insert({
  25. name: { first: "Bob", last: "Smith" },
  26. age: 31,
  27. email: "bob.smith@gmail.com",
  28. passwordHash: "last_password_hash",
  29. logins: [
  30. { at: new Date(2012, 2, 3, 4, 5, 6), minutes: 59 },
  31. { at: new Date(2012, 3, 3, 4, 5, 6), minutes: 20 }
  32. ]
  33. });
  34. var u1 = db.users.findOne({ 'name.first': 'John' }),
  35. u2 = db.users.findOne({ 'name.first': 'Jane' }),
  36. u3 = db.users.findOne({ 'name.first': 'Bob' });
  37. db.links.insert({
  38. title: 'Nettuts+',
  39. url: 'http://net.tutsplus.com',
  40. comment: 'Great site for web dev tutorials',
  41. tags: ['tutorials', 'dev', 'code'],
  42. favorites: 100,
  43. userId: u1._id
  44. });
  45. db.links.insert({
  46. title: 'Psdtuts+',
  47. url: 'http://psd.tutsplus.com',
  48. comment: 'Photoshop tutorials like no other',
  49. tags: ['photoshop', 'tutorials'],
  50. favorites: 507,
  51. userId: u2._id
  52. });
  53. db.links.insert({
  54. title: 'Tuts+ Premium',
  55. url: 'http://tutsplus.com',
  56. comment: 'The best screencast courses ever',
  57. tags: ['screencasts', 'tutorials'],
  58. favorites: 149,
  59. userId: u1._id
  60. });
  61. db.links.insert({
  62. title: 'Envato',
  63. url: 'http://envato.com',
  64. comment: 'Greatest company in Australia',
  65. tags: ['business', 'australia'],
  66. favorites: 279,
  67. userId: u2._id
  68. });
  69. db.links.insert({
  70. title: 'MongoDB.org',
  71. url: 'http://mongodb.org',
  72. comment: 'Really cool NoSQL database',
  73. tags: ['database', 'development'],
  74. favorites: 79,
  75. userId: u3._id
  76. });
  77. db.links.insert({
  78. title: 'Audible Audio Books',
  79. url: 'http://www.audible.com',
  80. comment: 'Good audio books',
  81. tags: ['books', 'audio'],
  82. favorites: 100,
  83. userId: u2._id
  84. });
  85. db.links.insert({
  86. title: 'Wikipedia',
  87. url: 'http://wikipedia.org',
  88. comment: 'The source of all knowledge',
  89. tags: ['information', 'encyclopedia', 'online', 'wikis'],
  90. favorites: 187,
  91. userId: u3._id
  92. });
  93. db.links.insert({
  94. title: 'Mobiletuts+',
  95. url: 'http://mobile.tutsplus.com',
  96. comment: 'Great tutorials for developing on mobile devices',
  97. tags: ['mobile', 'development'],
  98. favorites: 84,
  99. userId: u2._id
  100. });
  101. db.links.insert({
  102. title: 'Amazon.com',
  103. url: 'http://www.amazon.com',
  104. comment: 'Where to buy things',
  105. tags: ['selling', 'buying'],
  106. favorites: 329,
  107. userId: u1._id
  108. });
  109. db.links.insert({
  110. title: 'ThemeForest',
  111. url: 'http://themeforest.net',
  112. comment: 'Where to buy the best website themes',
  113. tags: ['marketplace', 'themes'],
  114. favorites: 654,
  115. userId: u1._id
  116. });
  117. db.links.insert({
  118. title: 'CodeCanyon',
  119. url: 'http://codecanyon.net',
  120. comment: 'A marketplace for code',
  121. tags: ['marketplace', 'code'],
  122. favorites: 217,
  123. userId: u2._id
  124. });
  125. db.links.insert({
  126. title: 'GraphicRiver',
  127. url: 'http://graphicriver.net',
  128. comment: 'A marketplace for graphics',
  129. tags: ['marketplace', 'graphics'],
  130. favorites: 543,
  131. userId: u3._id
  132. });