Permalink
Browse files

Merge branch 'master' of https://github.com/couchbaselabs/DeveloperDay

  • Loading branch information...
johnzablocki committed Jan 22, 2013
2 parents eedd0a8 + b84be75 commit 9f5467c57c0db3fd5b4616caedbebac6d3da7acd
Showing with 180 additions and 25,330 deletions.
  1. +7 −4 Nodejs/01_connect.js
  2. +49 −62 Nodejs/02_storage.js
  3. +42 −0 Nodejs/03_storage_json.js
  4. +0 −22 Nodejs/03_storage_json.rb
  5. +71 −0 Nodejs/04_retrieve.js
  6. +0 −53 Nodejs/04_retrieve.rb
  7. +0 −50 Nodejs/05_atomic_counters.rb
  8. +0 −78 Nodejs/06_cas.rb
  9. +0 −29 Nodejs/07_observe.rb
  10. +0 −13 Nodejs/08_views.rb
  11. +0 −6 Nodejs/hello.js
  12. +0 −1 Nodejs/node_modules/couchbase/.npmignore
  13. +0 −15 Nodejs/node_modules/couchbase/AUTHORS
  14. +0 −49 Nodejs/node_modules/couchbase/CONTRIBUTING.md
  15. +0 −202 Nodejs/node_modules/couchbase/LICENSE
  16. +0 −57 Nodejs/node_modules/couchbase/README.md
  17. +0 −87 Nodejs/node_modules/couchbase/binding.gyp
  18. +0 −359 Nodejs/node_modules/couchbase/build/Makefile
  19. +0 −1 Nodejs/node_modules/couchbase/build/Release/.deps/Release/couchbase_impl.node.d
  20. +0 −22 Nodejs/node_modules/couchbase/build/Release/.deps/Release/obj.target/couchbase_impl/io/common.o.d
  21. +0 −22 .../node_modules/couchbase/build/Release/.deps/Release/obj.target/couchbase_impl/io/plugin-libuv.o.d
  22. +0 −22 Nodejs/node_modules/couchbase/build/Release/.deps/Release/obj.target/couchbase_impl/io/read.o.d
  23. +0 −22 Nodejs/node_modules/couchbase/build/Release/.deps/Release/obj.target/couchbase_impl/io/socket.o.d
  24. +0 −22 Nodejs/node_modules/couchbase/build/Release/.deps/Release/obj.target/couchbase_impl/io/timer.o.d
  25. +0 −3 .../node_modules/couchbase/build/Release/.deps/Release/obj.target/couchbase_impl/io/util/hexdump.o.d
  26. +0 −5 ...modules/couchbase/build/Release/.deps/Release/obj.target/couchbase_impl/io/util/lcb_luv_yolog.o.d
  27. +0 −22 Nodejs/node_modules/couchbase/build/Release/.deps/Release/obj.target/couchbase_impl/io/write.o.d
  28. +0 −35 Nodejs/node_modules/couchbase/build/Release/.deps/Release/obj.target/couchbase_impl/src/args.o.d
  29. +0 −35 Nodejs/node_modules/couchbase/build/Release/.deps/Release/obj.target/couchbase_impl/src/cas.o.d
  30. +0 −38 ...de_modules/couchbase/build/Release/.deps/Release/obj.target/couchbase_impl/src/couchbase_impl.o.d
  31. +0 −35 Nodejs/node_modules/couchbase/build/Release/.deps/Release/obj.target/couchbase_impl/src/namemap.o.d
  32. +0 −35 Nodejs/node_modules/couchbase/build/Release/.deps/Release/obj.target/couchbase_impl/src/notify.o.d
  33. +0 −35 ...s/node_modules/couchbase/build/Release/.deps/Release/obj.target/couchbase_impl/src/operations.o.d
  34. BIN Nodejs/node_modules/couchbase/build/Release/couchbase_impl.node
  35. 0 Nodejs/node_modules/couchbase/build/Release/linker.lock
  36. BIN Nodejs/node_modules/couchbase/build/Release/obj.target/couchbase_impl/io/common.o
  37. BIN Nodejs/node_modules/couchbase/build/Release/obj.target/couchbase_impl/io/plugin-libuv.o
  38. BIN Nodejs/node_modules/couchbase/build/Release/obj.target/couchbase_impl/io/read.o
  39. BIN Nodejs/node_modules/couchbase/build/Release/obj.target/couchbase_impl/io/socket.o
  40. BIN Nodejs/node_modules/couchbase/build/Release/obj.target/couchbase_impl/io/timer.o
  41. BIN Nodejs/node_modules/couchbase/build/Release/obj.target/couchbase_impl/io/util/hexdump.o
  42. BIN Nodejs/node_modules/couchbase/build/Release/obj.target/couchbase_impl/io/util/lcb_luv_yolog.o
  43. BIN Nodejs/node_modules/couchbase/build/Release/obj.target/couchbase_impl/io/write.o
  44. BIN Nodejs/node_modules/couchbase/build/Release/obj.target/couchbase_impl/src/args.o
  45. BIN Nodejs/node_modules/couchbase/build/Release/obj.target/couchbase_impl/src/cas.o
  46. BIN Nodejs/node_modules/couchbase/build/Release/obj.target/couchbase_impl/src/couchbase_impl.o
  47. BIN Nodejs/node_modules/couchbase/build/Release/obj.target/couchbase_impl/src/namemap.o
  48. BIN Nodejs/node_modules/couchbase/build/Release/obj.target/couchbase_impl/src/notify.o
  49. BIN Nodejs/node_modules/couchbase/build/Release/obj.target/couchbase_impl/src/operations.o
  50. +0 −6 Nodejs/node_modules/couchbase/build/binding.Makefile
  51. +0 −103 Nodejs/node_modules/couchbase/build/config.gypi
  52. +0 −171 Nodejs/node_modules/couchbase/build/couchbase_impl.target.mk
  53. +0 −210 Nodejs/node_modules/couchbase/build/gyp-mac-tool
  54. +0 −23 Nodejs/node_modules/couchbase/example.js
  55. +0 −6 Nodejs/node_modules/couchbase/io/.npmignore
  56. +0 −458 Nodejs/node_modules/couchbase/io/common.c
  57. +0 −297 Nodejs/node_modules/couchbase/io/lcb_luv_internal.h
  58. +0 −84 Nodejs/node_modules/couchbase/io/libcouchbase-libuv.h
  59. +0 −118 Nodejs/node_modules/couchbase/io/plugin-libuv.c
  60. +0 −204 Nodejs/node_modules/couchbase/io/read.c
  61. +0 −136 Nodejs/node_modules/couchbase/io/socket.c
  62. +0 −60 Nodejs/node_modules/couchbase/io/timer.c
  63. +0 −67 Nodejs/node_modules/couchbase/io/util/hexdump.c
  64. +0 −2,164 Nodejs/node_modules/couchbase/io/util/lcb_luv_yolog.c
  65. +0 −1,353 Nodejs/node_modules/couchbase/io/util/lcb_luv_yolog.h
  66. +0 −175 Nodejs/node_modules/couchbase/io/write.c
  67. +0 −560 Nodejs/node_modules/couchbase/lib/bucket.js
  68. +0 −130 Nodejs/node_modules/couchbase/lib/couchbase.js
  69. +0 −97 Nodejs/node_modules/couchbase/node_modules/bindings/README.md
  70. +0 −151 Nodejs/node_modules/couchbase/node_modules/bindings/bindings.js
  71. +0 −28 Nodejs/node_modules/couchbase/node_modules/bindings/package.json
  72. +0 −55 Nodejs/node_modules/couchbase/node_modules/request/LICENSE
  73. +0 −309 Nodejs/node_modules/couchbase/node_modules/request/README.md
  74. +0 −190 Nodejs/node_modules/couchbase/node_modules/request/aws.js
  75. +0 −103 Nodejs/node_modules/couchbase/node_modules/request/forever.js
  76. +0 −1,096 Nodejs/node_modules/couchbase/node_modules/request/main.js
  77. +0 −5 Nodejs/node_modules/couchbase/node_modules/request/node_modules/form-data/.npmignore
  78. +0 −7 Nodejs/node_modules/couchbase/node_modules/request/node_modules/form-data/Makefile
  79. +0 −86 Nodejs/node_modules/couchbase/node_modules/request/node_modules/form-data/Readme.md
  80. +0 −237 Nodejs/node_modules/couchbase/node_modules/request/node_modules/form-data/lib/form_data.js
  81. +0 −8 ...node_modules/couchbase/node_modules/request/node_modules/form-data/node-form-data.sublime-project
  82. +0 −508 ...de_modules/couchbase/node_modules/request/node_modules/form-data/node-form-data.sublime-workspace
  83. +0 −9 ...node_modules/couchbase/node_modules/request/node_modules/form-data/node_modules/async/.gitmodules
  84. +0 −19 Nodejs/node_modules/couchbase/node_modules/request/node_modules/form-data/node_modules/async/LICENSE
  85. +0 −21 ...js/node_modules/couchbase/node_modules/request/node_modules/form-data/node_modules/async/Makefile
  86. +0 −970 ...s/node_modules/couchbase/node_modules/request/node_modules/form-data/node_modules/async/README.md
  87. BIN ...odules/couchbase/node_modules/request/node_modules/form-data/node_modules/async/async.min.js.gzip
  88. +0 −70 ...odules/couchbase/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.css
  89. +0 −1,966 ...modules/couchbase/node_modules/request/node_modules/form-data/node_modules/async/deps/nodeunit.js
  90. +0 −1 ...odules/couchbase/node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js
  91. +0 −3 ...js/node_modules/couchbase/node_modules/request/node_modules/form-data/node_modules/async/index.js
  92. +0 −632 ...ode_modules/couchbase/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js
  93. +0 −4 ...ode_modules/couchbase/node_modules/request/node_modules/form-data/node_modules/async/nodelint.cfg
  94. +0 −41 ...ode_modules/couchbase/node_modules/request/node_modules/form-data/node_modules/async/package.json
  95. BIN ...s/node_modules/couchbase/node_modules/request/node_modules/form-data/node_modules/async/test/.swp
  96. +0 −1,367 ...dules/couchbase/node_modules/request/node_modules/form-data/node_modules/async/test/test-async.js
  97. +0 −24 ...e_modules/couchbase/node_modules/request/node_modules/form-data/node_modules/async/test/test.html
  98. +0 −3 ...les/couchbase/node_modules/request/node_modules/form-data/node_modules/combined-stream/.npmignore
  99. +0 −19 ...odules/couchbase/node_modules/request/node_modules/form-data/node_modules/combined-stream/License
  100. +0 −7 ...dules/couchbase/node_modules/request/node_modules/form-data/node_modules/combined-stream/Makefile
  101. +0 −132 ...ules/couchbase/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md
  102. +0 −183 ...e/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js
  103. +0 −2 ...equest/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore
  104. +0 −19 ...s/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License
  105. +0 −7 .../request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile
  106. +0 −154 ...request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md
  107. +0 −99 ..._modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js
  108. +0 −38 ...uest/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json
  109. +0 −6 ...st/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js
  110. +0 −38 ..._modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js
  111. +0 −21 ...es/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js
  112. +0 −14 ...modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js
  113. +0 −48 .../node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js
  114. +0 −15 ...modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js
  115. +0 −18 ...a/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js
  116. +0 −13 ...ta/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js
  117. +0 −13 .../node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js
  118. +0 −7 ...quest/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js
  119. +0 −39 ...s/couchbase/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json
  120. +0 −12 ...couchbase/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/common.js
  121. +0 −256 ...e/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file1.txt
  122. +0 −256 ...e/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/fixture/file2.txt
  123. +0 −27 ...est/node_modules/form-data/node_modules/combined-stream/test/integration/test-callback-streams.js
  124. +0 −34 ...es/request/node_modules/form-data/node_modules/combined-stream/test/integration/test-data-size.js
  125. +0 −38 ...ata/node_modules/combined-stream/test/integration/test-delayed-streams-and-buffers-and-strings.js
  126. +0 −35 ...uest/node_modules/form-data/node_modules/combined-stream/test/integration/test-delayed-streams.js
  127. +0 −24 ...equest/node_modules/form-data/node_modules/combined-stream/test/integration/test-max-data-size.js
  128. +0 −30 ...est/node_modules/form-data/node_modules/combined-stream/test/integration/test-unpaused-streams.js
  129. +0 −7 ...es/couchbase/node_modules/request/node_modules/form-data/node_modules/combined-stream/test/run.js
  130. +0 −43 Nodejs/node_modules/couchbase/node_modules/request/node_modules/form-data/package.json
  131. +0 −14 Nodejs/node_modules/couchbase/node_modules/request/node_modules/form-data/test/common.js
  132. +0 −1 Nodejs/node_modules/couchbase/node_modules/request/node_modules/form-data/test/fixture/bacon.txt
  133. BIN Nodejs/node_modules/couchbase/node_modules/request/node_modules/form-data/test/fixture/unicycle.jpg
  134. +0 −93 ...es/couchbase/node_modules/request/node_modules/form-data/test/integration/test-form-get-length.js
  135. +0 −18 ...dules/couchbase/node_modules/request/node_modules/form-data/test/integration/test-get-boundary.js
  136. +0 −121 ...ules/couchbase/node_modules/request/node_modules/form-data/test/integration/test-http-response.js
  137. +0 −111 .../node_modules/couchbase/node_modules/request/node_modules/form-data/test/integration/test-pipe.js
  138. +0 −107 ...ode_modules/couchbase/node_modules/request/node_modules/form-data/test/integration/test-submit.js
  139. +0 −7 Nodejs/node_modules/couchbase/node_modules/request/node_modules/form-data/test/run.js
  140. +0 −19 Nodejs/node_modules/couchbase/node_modules/request/node_modules/mime/LICENSE
  141. +0 −63 Nodejs/node_modules/couchbase/node_modules/request/node_modules/mime/README.md
  142. +0 −104 Nodejs/node_modules/couchbase/node_modules/request/node_modules/mime/mime.js
  143. +0 −42 Nodejs/node_modules/couchbase/node_modules/request/node_modules/mime/package.json
  144. +0 −55 Nodejs/node_modules/couchbase/node_modules/request/node_modules/mime/test.js
  145. +0 −1,588 Nodejs/node_modules/couchbase/node_modules/request/node_modules/mime/types/mime.types
  146. +0 −59 Nodejs/node_modules/couchbase/node_modules/request/node_modules/mime/types/node.types
  147. +0 −34 Nodejs/node_modules/couchbase/node_modules/request/oauth.js
  148. +0 −41 Nodejs/node_modules/couchbase/node_modules/request/package.json
  149. BIN Nodejs/node_modules/couchbase/node_modules/request/tests/googledoodle.png
  150. +0 −45 Nodejs/node_modules/couchbase/node_modules/request/tests/run.js
  151. +0 −86 Nodejs/node_modules/couchbase/node_modules/request/tests/server.js
  152. +0 −77 Nodejs/node_modules/couchbase/node_modules/request/tests/squid.conf
  153. +0 −20 Nodejs/node_modules/couchbase/node_modules/request/tests/ssl/ca/ca.cnf
  154. 0 Nodejs/node_modules/couchbase/node_modules/request/tests/ssl/ca/ca.crl
  155. +0 −17 Nodejs/node_modules/couchbase/node_modules/request/tests/ssl/ca/ca.crt
  156. +0 −13 Nodejs/node_modules/couchbase/node_modules/request/tests/ssl/ca/ca.csr
  157. +0 −18 Nodejs/node_modules/couchbase/node_modules/request/tests/ssl/ca/ca.key
  158. +0 −1 Nodejs/node_modules/couchbase/node_modules/request/tests/ssl/ca/ca.srl
  159. +0 −19 Nodejs/node_modules/couchbase/node_modules/request/tests/ssl/ca/server.cnf
  160. +0 −16 Nodejs/node_modules/couchbase/node_modules/request/tests/ssl/ca/server.crt
  161. +0 −11 Nodejs/node_modules/couchbase/node_modules/request/tests/ssl/ca/server.csr
  162. +0 −28 Nodejs/node_modules/couchbase/node_modules/request/tests/ssl/ca/server.js
  163. +0 −9 Nodejs/node_modules/couchbase/node_modules/request/tests/ssl/ca/server.key
  164. +0 −16 Nodejs/node_modules/couchbase/node_modules/request/tests/ssl/npm-ca.crt
  165. +0 −15 Nodejs/node_modules/couchbase/node_modules/request/tests/ssl/test.crt
  166. +0 −15 Nodejs/node_modules/couchbase/node_modules/request/tests/ssl/test.key
  167. +0 −117 Nodejs/node_modules/couchbase/node_modules/request/tests/test-body.js
  168. +0 −29 Nodejs/node_modules/couchbase/node_modules/request/tests/test-cookie.js
  169. +0 −90 Nodejs/node_modules/couchbase/node_modules/request/tests/test-cookiejar.js
  170. +0 −99 Nodejs/node_modules/couchbase/node_modules/request/tests/test-defaults.js
  171. +0 −37 Nodejs/node_modules/couchbase/node_modules/request/tests/test-errors.js
  172. +0 −30 Nodejs/node_modules/couchbase/node_modules/request/tests/test-follow-all-303.js
  173. +0 −35 Nodejs/node_modules/couchbase/node_modules/request/tests/test-follow-all.js
  174. +0 −79 Nodejs/node_modules/couchbase/node_modules/request/tests/test-form.js
  175. +0 −52 Nodejs/node_modules/couchbase/node_modules/request/tests/test-headers.js
  176. +0 −94 Nodejs/node_modules/couchbase/node_modules/request/tests/test-httpModule.js
  177. +0 −97 Nodejs/node_modules/couchbase/node_modules/request/tests/test-https-strict.js
  178. +0 −86 Nodejs/node_modules/couchbase/node_modules/request/tests/test-https.js
  179. +0 −117 Nodejs/node_modules/couchbase/node_modules/request/tests/test-oauth.js
  180. +0 −92 Nodejs/node_modules/couchbase/node_modules/request/tests/test-params.js
  181. +0 −52 Nodejs/node_modules/couchbase/node_modules/request/tests/test-piped-redirect.js
  182. +0 −202 Nodejs/node_modules/couchbase/node_modules/request/tests/test-pipes.js
  183. +0 −16 Nodejs/node_modules/couchbase/node_modules/request/tests/test-pool.js
  184. +0 −60 Nodejs/node_modules/couchbase/node_modules/request/tests/test-protocol-changing-redirect.js
  185. +0 −39 Nodejs/node_modules/couchbase/node_modules/request/tests/test-proxy.js
  186. +0 −28 Nodejs/node_modules/couchbase/node_modules/request/tests/test-qs.js
  187. +0 −154 Nodejs/node_modules/couchbase/node_modules/request/tests/test-redirect.js
  188. +0 −13 Nodejs/node_modules/couchbase/node_modules/request/tests/test-s3.js
  189. +0 −87 Nodejs/node_modules/couchbase/node_modules/request/tests/test-timeout.js
  190. +0 −14 Nodejs/node_modules/couchbase/node_modules/request/tests/test-toJSON.js
  191. +0 −63 Nodejs/node_modules/couchbase/node_modules/request/tests/test-tunnel.js
  192. BIN Nodejs/node_modules/couchbase/node_modules/request/tests/unicycle.jpg
  193. +0 −230 Nodejs/node_modules/couchbase/node_modules/request/tunnel.js
  194. +0 −19 Nodejs/node_modules/couchbase/node_modules/request/uuid.js
  195. +0 −65 Nodejs/node_modules/couchbase/node_modules/request/vendor/cookie/index.js
  196. +0 −72 Nodejs/node_modules/couchbase/node_modules/request/vendor/cookie/jar.js
  197. +0 −79 Nodejs/node_modules/couchbase/package.json
  198. +0 −345 Nodejs/node_modules/couchbase/src/args.cc
  199. +0 −136 Nodejs/node_modules/couchbase/src/args.h
  200. +0 −92 Nodejs/node_modules/couchbase/src/cas.cc
  201. +0 −21 Nodejs/node_modules/couchbase/src/cas.h
  202. +0 −73 Nodejs/node_modules/couchbase/src/cookie.h
  203. +0 −409 Nodejs/node_modules/couchbase/src/couchbase_impl.cc
  204. +0 −198 Nodejs/node_modules/couchbase/src/couchbase_impl.h
  205. +0 −39 Nodejs/node_modules/couchbase/src/namemap.cc
  206. +0 −50 Nodejs/node_modules/couchbase/src/namemap.h
  207. +0 −331 Nodejs/node_modules/couchbase/src/notify.cc
  208. +0 −225 Nodejs/node_modules/couchbase/src/operations.cc
  209. +0 −39 Nodejs/node_modules/couchbase/tests/00-args.t.js
  210. +0 −49 Nodejs/node_modules/couchbase/tests/01-set.js
  211. +0 −85 Nodejs/node_modules/couchbase/tests/02-get.js
  212. +0 −53 Nodejs/node_modules/couchbase/tests/03-multiget.js
  213. +0 −32 Nodejs/node_modules/couchbase/tests/04-remove.js
  214. +0 −31 Nodejs/node_modules/couchbase/tests/05-replace.js
  215. +0 −25 Nodejs/node_modules/couchbase/tests/06-add.js
  216. +0 −36 Nodejs/node_modules/couchbase/tests/07-exception-handling.js
  217. +0 −53 Nodejs/node_modules/couchbase/tests/08-views.js
  218. +0 −102 Nodejs/node_modules/couchbase/tests/09-incr-decr.js
  219. +0 −14 Nodejs/node_modules/couchbase/tests/10-strerror.js
  220. +0 −32 Nodejs/node_modules/couchbase/tests/11-jscbc-4.js
  221. +0 −39 Nodejs/node_modules/couchbase/tests/12-observe.js
  222. +0 −28 Nodejs/node_modules/couchbase/tests/13-endure.js
  223. +0 −83 Nodejs/node_modules/couchbase/tests/14-prepend-append.js
  224. +0 −24 Nodejs/node_modules/couchbase/tests/README.md
  225. +0 −22 Nodejs/node_modules/couchbase/tests/bug.js
  226. +0 −6 Nodejs/node_modules/couchbase/tests/config.json.sample
  227. +0 −16 Nodejs/node_modules/couchbase/tests/runtests.sh
  228. +0 −58 Nodejs/node_modules/couchbase/tests/setup.js
  229. +1 −1 README.md
  230. +10 −23 Ruby/README.md
View
@@ -1,11 +1,13 @@
var couchnode = require('couchbase');
-var port = 8080;
+console.log("--------------------------------------------------------------------------");
+console.log("Couchbase Connections");
+console.log("--------------------------------------------------------------------------");
+
couchnode.connect({
- "username": "",
"password": "",
- "hostname": "localhost:8091",
+ "hosts": ["localhost:8091"],
"bucket": "default"},
function(err, cb) {
if (err) {
@@ -16,7 +18,8 @@ couchnode.connect({
console.log( cb );
- console.log( "\n\nPress ctrl+c to quit" );
+ console.log("\n\n--------------------------------------------------------------------------");
+ console.log( "\tPress ctrl+c to quit" );
});
View
@@ -1,69 +1,56 @@
var couchnode = require('couchbase');
-var port = 8080;
+console.log("--------------------------------------------------------------------------");
+console.log("Couchbase Storage Operations");
+console.log("--------------------------------------------------------------------------");
couchnode.connect({
- "username": "",
- "password": "",
- "hostname": "localhost:8091",
- "bucket": "default"},
- function(err, cb) {
- if (err) {
- throw (err)
- }
-
-
- cb.set( "mytest" , "my value" , function (err, meta) {
- // in the call back
- cb.get( "mytest", function (err, value, meta) {
- console.log("Value : "+ value);
-
-
- cb.add( "mytest" , "my value" , function (err, meta) {
- if (err) {
- console.log(err);
- } else {
- console.log("It should have failed..");
- }
-
- });
-
-
- });
+ "password": "",
+ "hosts": ["localhost:8091"],
+ "bucket": "default"
+}, function(err, cb) {
+ if (err) {
+ throw (err)
+ }
+
+
+
+ console.log("Set a Key-Value and Get the Key-Value");
+ cb.set("mytest", "my value", function(err, meta) {
+ // in the call back
+ cb.get("mytest", function(err, value, meta) {
+ console.log("cb.get(\"mytest\") : " + value);
+
+ console.log("\nTry to Add the same key, raises exception");
+ cb.add("mytest", "my value", function(err, meta) {
+ if (err) {
+ console.log(err);
+ } else {
+ console.log("It should have failed..");
+ }
+
+ cb.replace("mytest", "my value replaced", function(err, meta) {
+ console.log("\nReplace the key-value with Replace");
+ cb.get("mytest", function(err, value, meta) {
+ console.log("cb.get(\"mytest\") : " + value);
+
+ console.log("\nTry to replace non existant key");
+ cb.replace("mytest4", "my value4 replaced", function(err, meta) {
+ if (err) {
+ console.log(err);
+ } else {
+ console.log("It should have failed..");
+ }
+
+ console.log("\n--------------------------------------------------------------------------");
+ process.exit(0);
+
+ });
+
+ });
+ });
+ });
+ });
});
-
-
-
});
-
-//
-//
-//
-//
-// // create a key
-// cb.set("mytest", "my value")
-// puts cb.get("mytest")
-//
-// // this raises key exists exception, uncomment to see error
-// cb.add("mytest", "my value added")
-//
-// // success
-// cb.replace("mytest", "my value replaced")
-// puts cb.get("mytest")
-//
-// // this raises exception (doesn’t exist)
-// cb.replace("mytest4", "my value4 replaced")
-//
-// // success
-// cb.add("mytest3", "my value3")
-// puts cb.get("mytest3")
-//
-// cb.delete("mytest")
-// cb.delete("mytest3")
-//
-//
-// // both of these return nil class
-// puts cb.get("mytest").class.to_s
-// puts cb.get("mytest3").class.to_s
-
View
@@ -0,0 +1,42 @@
+var couchnode = require('couchbase');
+
+console.log("--------------------------------------------------------------------------");
+console.log("Couchbase JSON Doc Storage");
+console.log("--------------------------------------------------------------------------");
+
+couchnode.connect({
+ "password": "",
+ "hosts": ["localhost:8091"],
+ "bucket": "default"
+}, function(err, cb) {
+ if (err) {
+ throw (err)
+ }
+
+
+ var myDoc = {
+ doctype : "test",
+ name : "John Smith"
+ };
+
+ console.log("Set Document");
+ cb.set("mydoc", myDoc, function(err, meta) {
+ // in the call back
+ cb.get("mydoc", function(err, value, meta) {
+ console.log('mydoc.name : '+ value.name);
+
+ cb.touch("mydoc", 10, function(err, meta) {
+ console.log(" Touch the doc with TTL");
+ console.log("\n--------------------------------------------------------------------------");
+ process.exit(0);
+ });
+
+
+ });
+ });
+
+
+
+
+});
+
View
@@ -1,22 +0,0 @@
-#!/usr/bin/env ruby
-
-require "couchbase"
-require "json"
-
-# establish connection
-cb = Couchbase.connect
-
-mydoc = {
- :doctype => "test",
- :name => "John Smith"
-}
-
-# store a json doc (encode it)
-cb.set("mydoc", mydoc)
-
-# retrieve and decode json doc
-doc = cb.get("mydoc")
-puts doc["name"]
-
-# delete the test docs to repeat tests
-cb.delete("mydoc")
View
@@ -0,0 +1,71 @@
+var couchnode = require('couchbase');
+
+console.log("--------------------------------------------------------------------------");
+console.log("Couchbase Retrieval Operations");
+console.log("--------------------------------------------------------------------------");
+
+
+var userData1 = {
+ doctype : "learn",
+ username : "jsmith",
+ name : "John Smith",
+ email : "jsmith@email.com",
+ password : "p4ssw0rd",
+ logins : 0
+}
+
+var userData2 = {
+ doctype : "learn",
+ username : "xsmith",
+ name : "Xavier Smith",
+ email : "xsmith@email.com",
+ password : "p4ssw0rd",
+ logins : 0
+}
+
+couchnode.connect({
+ "password": "",
+ "hosts": ["localhost:8091"],
+ "bucket": "default"
+}, function(err, cb) {
+ if (err) {
+ throw (err)
+ }
+
+
+
+ cb.set( userData1.email , userData1, function(err, meta) {
+ var metaUser1 = meta;
+ cb.set( userData2.email , userData2, function(err, meta) {
+ console.log( "User 1 and User2 saved" );
+ var metaUser2 = meta;
+
+ console.log("CAS User 1:"+ metaUser1.cas.str);
+ console.log("CAS USer 2:"+ metaUser2.cas.str);
+
+
+ console.log("\nUpdate the doc and check the CAS");
+ userData1.logins += 1;
+
+ cb.set( userData1.email , userData1, function(err, meta) {
+ console.log("Different CAS ");
+ console.log("\tBefore update : "+metaUser1.cas.str);
+ console.log("\tAfter CAS : "+ meta.cas.str);
+
+
+ console.log("\n--------------------------------------------------------------------------");
+ process.exit(0);
+ });
+
+
+
+
+ });
+
+ });
+
+
+
+
+});
+
View
@@ -1,53 +0,0 @@
-#!/usr/bin/env ruby
-
-require "couchbase"
-
-# establish connection, all different ways
-cb = Couchbase.connect
-
-user_data1 = {
- :doctype => "learn",
- :username => "jsmith",
- :name => "John Smith",
- :email => "jsmith@email.com",
- :password => "p4ssw0rd",
- :logins => 0
-}
-
-user_data2 = {
- :doctype => "learn",
- :username => "xsmith",
- :name => "Xavier Smith",
- :email => "xsmith@email.com",
- :password => "p4ssw0rd",
- :logins => 0
-}
-
-# initialize the documents
-cb.set(user_data1[:email], user_data1)
-cb.set(user_data2[:email], user_data2)
-
-# retrieve the document and output
-doc = cb.get(user_data1[:email])
-puts "Retrieve Doc and Inspect"
-puts doc.inspect
-puts
-
-# retrieve extended info
-doc, flags, cas = cb.get(user_data1[:email], :extended => true)
-puts "Retrieve Doc Extended Info and Inspect"
-puts doc.inspect
-puts "cas = #{cas}"
-puts "update doc and look at cas"
-
-# update some info in doc
-doc["logins"] += 1
-
-# replace the doc in couchbase
-cb.replace(doc["email"], doc)
-
-# retrieve and re-output
-doc, flags, cas = cb.get(user_data1[:email], :extended => true)
-puts doc.inspect
-puts "cas = #{cas}"
-puts
@@ -1,50 +0,0 @@
-#!/usr/bin/env ruby
-
-require "couchbase"
-
-# establish connection, all different ways
-cb = Couchbase.connect
-
-cb.set("counter", 0)
-
-# increase by 1
-cb.incr("counter")
-
-# returns 1
-puts cb.get("counter")
-
-# delete it
-cb.delete("counter")
-
-# creates and sets to initial (doesn't increase)
-cb.incr("counter", :initial => 1)
-
-# returns 1
-puts cb.get("counter")
-
-# since it exists, adds 1 to counter
-cb.incr("counter", :initial => 1)
-
-# returns 1
-puts cb.get("counter")
-
-# doesn't decrease below 0
-cb.set("counter", 0)
-cb.decr("counter")
-
-# returns 0
-puts cb.get("counter")
-
-# sets to max value
-cb.set("counter", -1)
-cb.decr("counter")
-cb.incr("counter")
-
-# returns 18446744073709551615
-puts cb.get("counter")
-
-# add one to max
-cb.incr("counter")
-
-# returns 0
-puts cb.get("counter")
Oops, something went wrong.

0 comments on commit 9f5467c

Please sign in to comment.