Skip to content

NewRedo/couchdb-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

couchdb-utils

Usage

const CouchDbUtils = require("couchdb-utils");

API Documentation

CouchDbUtils

Utilities for CouchDB databases.

Kind: global class

CouchDbUtils.replicateWithoutDesignDocs(options)

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.

CouchDbUtils._startReplication(source, target) ⇒ 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.

CouchDbUtils._getReplication(dbLocation, replicationId)

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.

CouchDbUtils._getReplicationTask(dbLocation, replicationId) ⇒ object | null

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.

CouchDbUtils.mutateAllDocs(options) ⇒ Promise

Mutates all documents in a given database. Will throw an error and halt if any of the following conditions are true:

  1. A validator is provided and the document is invalid.
  2. 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.

CouchDbUtils.refreshViews(options)

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published