cloudant / nodejs-cloudant

Cloudant Node.js client library
Apache License 2.0
255 stars 90 forks source link

Add partitioned database support. #374

Closed smithsz closed 5 years ago

smithsz commented 5 years ago

Checklist

Description

Add partitioned database support.

Fixes #372.

Approach

Add additional partitioned functions to the cloudant object.

Schema & API Changes

Adds new API:

const db = cloudant.db.use(dbName);

// partition info
db.partitionInfo(partitionKey).then((body) => { ... });

// partitoned find
db.partitionedFind(partitionKey, selector, callback).then((body) => { ... });
db.partitionedFindAsStream(partitionKey, selector).pipe( ... )

// partitioned all docs
db.partitionedList(partitionKey, callback).then((body) => { ... });
db.partitionedListAsStream(partitionKey).pipe( ... )

// partitioned search
db.partitionedSearch(partitionKey, designName, searchName, params, callback).then((body) => { ... });
db.partitionedSearchAsStream(partitionKey, designName, searchName, params).pipe( ... )

// partitioned view
db.partitionedView(partitionKey, designName, viewName, params, callback).then((body) => { ... });
db.partitionedViewAsStream(partitionKey, designName, viewName, params).pipe( ... )

Security and Privacy

No change.

Testing

Includes additional unit tests.

Monitoring and Logging

No change.