const CouchDbUtils = require("couchdb-utils");
Utilities for CouchDB databases.
Kind: global class
Performs a one-time replication, filtering out design documents.
Kind: static method of CouchDbUtils
Param | Type | Description |
---|---|---|
options | object |
|
options.source | string |
Location of source CouchDB database. |
options.target | string |
Location of target CouchDB database. |
options.eventEmitter | object |
Optional event emitter for reporting progress. If provided, it will periodically emit "progress" events with a single "message" string. |
Kicks off a replication job.
Kind: static method of CouchDbUtils
Returns: string
- _id of replication document.
Param | Type | Description |
---|---|---|
source | string |
Location of source CouchDB database. |
target | string |
Location of target CouchDB database. |
Retrieves a replication document.
Kind: static method of CouchDbUtils
Param | Type | Description |
---|---|---|
dbLocation | string |
CouchDB database location. TODO: Should be base URL. |
replicationId | string |
_id of replication document. |
Retrieves an active replication task.
Kind: static method of CouchDbUtils
Returns: object
| null
- The replication task. null
if it doesn't exist.
Param | Type | Description |
---|---|---|
dbLocation | string |
CouchDB database location. TODO: Should be base URL. |
replicationId | string |
_id of replication document. |
Mutates all documents in a given database. Will throw an error and halt if any of the following conditions are true:
- A validator is provided and the document is invalid.
- options.verifyIdempotent is true and the mutation is not idempotent.
Kind: static method of CouchDbUtils
Returns: Promise
- Resolves upon successful mutation of all documents.
Param | Type | Description |
---|---|---|
options | object |
|
options.location | string |
Database location. |
options.mutator | function |
Mutator function. |
options.validator | function |
Optional validation function. |
options.verifyIdempotent | boolean |
Verify that mutations are idempotent. Does not apply by default. |
options.eventEmitter | object |
Optional event emitter for reporting progress. If provided, it will periodically emit "progress" events with a single "message" string. |
options.reportFrequency | number |
Progress report frequency, in number of documents. Defaults to 1. |
Refreshes all views in a database.
Kind: static method of CouchDbUtils
Param | Type | Description |
---|---|---|
options | object |
|
options.location | string |
Database location. |
options.eventEmitter | object |
Optional event emitter for reporting progress. If provided, it will periodically emit "progress" events with a single "message" string. |