Global

Methods

__protected()

Source:
Returns:
an object that exposes the private attributes of this instance

backup(filename, callback(err,)

backup/unload the current database to a key/value file.
Parameters:
Name Type Description
filename full path the the backup file
callback(err, rowCount)
Source:

close(callback(err))

close the current database
Parameters:
Name Type Description
callback(err)
Source:

createDomainKey(domain)

create a domain key using the domain name + ':' + a generated uuid
Parameters:
Name Type Description
domain the name of the domain, e.g., user, order, etc.
Source:
Returns:
the new id/key

createModelId()

create a unique id using uuid without the dashes
Source:
Returns:
unique id

delete(key, callback(err))

delete the model by key;
Parameters:
Name Type Description
key
callback(err)
Source:

find(key, callback(err,)

find the single model by key; returns the parsed model if found, error if not found (err.isNotFound)
Parameters:
Name Type Description
key the domain key for a specified model
callback(err, model)
Source:

insert(key, model, callback(err,)

insert a data model; set the dateCreated & lastUpdated to now and set version number to zero.
Parameters:
Name Type Description
key the domain specific key
model a data model
callback(err, model)
Source:

isInMemory()

Source:
Returns:
true if db is in-memory, false if file backed

open(callback(err))

open the database; should provide a callback to give the db time to open
Parameters:
Name Type Description
callback(err)
Source:

query(params, rowCallback(key,, completeCallback(err,)

query for a list of matching rows using rowCallback to evaluate key or model criteria. When a match is detected the model (parsed from value) is returned.
Parameters:
Name Type Description
params limit, offset
rowCallback(key, value) (value is the json string; it must be parsed to create the model
completeCallback(err, list)
Source:

restore(filename, callback(err,)

restore the backup file. the restore process only adds/updates values to the database so multiple files may be restored without affecting other non-related database rows.
Parameters:
Name Type Description
filename full path to the restore file
callback(err, rowsRestored)
Source:

stats(callback(err,)

calculate the database stats and verify that each row parses without error.
Parameters:
Name Type Description
callback(err, stats)
Source:

update(key, model, callback(err,)

update the current model; bump the version number and update the lastUpdated timestamp
Parameters:
Name Type Description
key
model
callback(err, model)
Source: