Expand all

ve.dm.DocumentStore

Constructor

new ve.dm.DocumentStore(storageClient, dbName, logger) #

Parameters:

Name Type Description
storageClient Object

MongoClient-like object; passed as a parameter for testing purposes

dbName string

Database name

logger Object

Logger class

Properties:
Name Type Description
logServerEvent function

Stringify object argument to log, adding timestamp and server ID properties

Source:

Methods

connect() → {Promise} #

Source:

Returns:

Resolves when connected

Type
Promise

dropDatabase() → {Promise} #

Source:

Returns:

Drops the entire database

Type
Promise

load(docName) → {Promise} #

Load a document from storage (creating as empty if absent)

Parameters:

Name Type Description
docName string

Name of the document

Source:

Returns:

Confirmed document history as a ve.dm.Change

Type
Promise
Load a document from storage (creating as empty if absent)

onNewChange(docName, change) → {Promise} #

Save a new change to storage

Parameters:

Name Type Description
docName string

Name of the document

change ve.dm.Change

The new change

Source:

Returns:

Resolves when saved

Type
Promise
Save a new change to storage