Name Date Size

..22-Jun-20214 KiB

.clang-formatH A D11-Feb-2020417

.gitignoreH A D11-Feb-2020338

.istanbul.ymlH A D11-Feb-202047

.jsbeautifyrcH A D11-Feb-2020907

.jsdocH A D11-Feb-2020542

.jshintrcH A D11-Feb-2020581

.npmignoreH A D11-Feb-2020134

AUTHORSH A D11-Feb-20201.2 KiB

binding.gypH A D11-Feb-20202.7 KiB

CONTRIBUTING.mdH A D11-Feb-20202.2 KiB

deps/lcb/H11-Feb-20204 KiB

example.jsH A D11-Feb-20201.3 KiB

lib/H11-Feb-20204 KiB

LICENSEH A D11-Feb-202011.1 KiB

MakefileH A D11-Feb-20202 KiB

package-lock.jsonH A D11-Feb-2020211.9 KiB

package.jsonH A D11-Feb-20201.3 KiB

README.mdH A D11-Feb-20204 KiB

src/H11-Feb-20204 KiB

test/H11-Feb-20204 KiB

README.md

1# Couchbase Node.js Client
2
3The Node.js SDK library allows you to connect to a Couchbase cluster from 
4Node.js. It is a native Node.js module and uses the very fast libcouchbase 
5library to handle communicating to the cluster over the Couchbase binary
6protocol.
7
8
9## Useful Links
10
11Source - [http://github.com/couchbase/couchnode](http://github.com/couchbase/couchnode)
12
13Bug Tracker - [http://www.couchbase.com/issues/browse/JSCBC](http://www.couchbase.com/issues/browse/JSCBC)
14
15Couchbase Developer Portal - [https://docs.couchbase.com/](https://docs.couchbase.com/nodejs-sdk/2.6/start-using-sdk.html)
16
17Release Notes - [https://docs.couchbase.com/nodejs-sdk/2.6/relnotes-nodejs-sdk.html](https://docs.couchbase.com/nodejs-sdk/2.6/relnotes-nodejs-sdk.html)
18
19## Installing
20
21To install the lastest release using npm, run:
22```bash
23npm install couchbase
24```
25
26To install the development version directly from github, run:
27```bash
28npm install "git+https://github.com/couchbase/couchnode.git#master"
29```
30
31
32## Introduction
33
34Connecting to a Couchbase bucket is as simple as creating a new `Cluster` 
35instance to represent the `Cluster` you are using, and then executing
36`openBucket` against this to open a connection to you specific bucket.  You
37are able to execute most operations immediately, and they will be queued
38until the connection is successfully established.
39
40Here is a simple example of instantiating a connection, adding a new document
41into the bucket and then retrieving its contents:
42
43```javascript
44var couchbase = require('couchbase');
45var cluster = new couchbase.Cluster('couchbase://127.0.0.1');
46// For Couchbase > 4.5 with RBAC Auth
47cluster.authenticate('username', 'password')
48var bucket = cluster.openBucket('default');
49
50bucket.upsert('testdoc', {name:'Frank'}, function(err, result) {
51  if (err) throw err;
52
53  bucket.get('testdoc', function(err, result) {
54    if (err) throw err;
55
56    console.log(result.value);
57    // {name: Frank}
58  });
59});
60```
61
62
63## Mock Testing
64
65As part of the core library, we additionally include a powerful Mock version
66of the library which supports a significant set of the features that are
67available when connected to a real Couchbase Server.
68
69As part of this library, we include a mock version of the client that supports
70nearly the exact same feature set as the library itself, but which does not
71require that a server be configured.  Note that these Mock connections currently
72are per-instance, if another connection is instantiated, none of the data will
73be shared.
74
75Using the Mock is as simple as this:
76```javascript
77var couchbase = require('couchbase').Mock;
78var cluster = new couchbase.Cluster();
79var bucket = cluster.openBucket();
80
81bucket.upsert('testdoc', {name:'Frank'}, function(err, result) {
82  if (err) throw err;
83
84  bucket.get('testdoc', function(err, result) {
85    if (err) throw err;
86
87    console.log(result.value);
88    // {name: Frank}
89  });
90```
91
92
93## Documentation
94
95An extensive documentation is available on the Couchbase website.  Visit our
96[Node.js Community](http://couchbase.com/communities/nodejs) on
97the [Couchbase](http://couchbase.com) website for the documentation as well as
98numerous examples and samples.
99
100
101## Source Control
102
103The source code is available at
104[https://github.com/couchbase/couchnode](https://github.com/couchbase/couchnode).
105Once you have cloned the repository, you may contribute changes through our
106gerrit server.  For more details see
107[CONTRIBUTING.md](https://github.com/couchbase/couchnode/blob/master/CONTRIBUTING.md).
108
109To execute our test suite, run `make test` from the root directory.
110
111To execute our code coverage, run `make cover` from the root directory.
112
113In addition to the full test suite and full code coverage, you may additionally
114execute a subset of the tests which excludes slow-running tests for quick
115verifications.  These can be run through `make fasttest` and `make fastcover`
116respectively.
117
118## License
119Copyright 2013 Couchbase Inc.
120
121Licensed under the Apache License, Version 2.0.
122
123See
124[LICENSE](https://github.com/couchbase/couchnode/blob/master/LICENSE)
125for further details.
126