couchbase-rest
v1.0.7
Published
This is a API for intracting with Couchbase using REST Endpoint Provided by Couchbase DB
Downloads
1
Readme
couchbase-rest
Description
This module can be used to get the data from Couchbase over REST API.
All the processes are similar to couchbase
SDK for Nodejs Developed
By Couchbase Team. This module is a kind of wrapper and can fetch the
data over REST API under the hood.
This is very helpful module when you are using Tunnel to get access to couchbase. In that case couchbase SDK of Nodejs does not work in cluster mode.
Installation
npm install couchbase-rest --save
Sample Code
Create Cluster Object
const cluster = await connect('http://localhost:8091/pools/default/buckets/%s/docs/%s', {
username: 'username',
password: 'password',
})
Get Bucket Object
const bucket = cluster.bucket('Bucket_Name')
Get Collection Information
const collection_default = bucket.defaultCollection()
Fetch the Value for KEYS passed
const result = await collection_default.get(key1, key2, key3)
Result would be in form of Array which will contain the results corresponding to keys passed. If specific key does not exist it would be undefined.