Class: BridgeStore

BridgeStore(db)

new BridgeStore(db)

Bridge store base class
Parameters:
Name Type Description
db Datastore
Source:

Methods

convertTo(func) → {function}

Convenience method to convert a document to something.
Parameters:
Name Type Description
func function The function which will be called with a single document object. Guaranteed not to be null.
Source:
Returns:
A transformFn function to pass to the standard select/delete/upsert/etc methods.
Type
function

delete(query, deferopt) → {Promise}

DELETE multiple documents.
Parameters:
Name Type Attributes Description
query Object
defer Deferred <optional>
Source:
Returns:
Type
Promise

insert(objects, deferopt) → {Promise}

INSERT a multiple documents.
Parameters:
Name Type Attributes Description
objects Object
defer Deferred <optional>
Source:
Returns:
Type
Promise

insertIfNotExists(query, insertObj) → {Promise}

INSERT IF NOT EXISTS a single document.
Parameters:
Name Type Description
query Object
insertObj Object
Source:
Returns:
Type
Promise

select(query, transformFn, deferopt) → {Promise}

SELECT a number of documents.
Parameters:
Name Type Attributes Description
query Object
transformFn function
defer Deferred <optional>
Source:
Returns:
Type
Promise

selectOne(query, transformFn, deferopt) → {Promise}

SELECT a single document.
Parameters:
Name Type Attributes Description
query Object
transformFn function
defer Deferred <optional>
Source:
Returns:
Type
Promise

setUnique(fieldName, sparse)

Set a UNIQUE key constraint on the given field.
Parameters:
Name Type Description
fieldName string The field name. Use dot notation for nested objects.
sparse boolean Allow sparse entries (undefined won't cause a key violation). Default: false.
Source:

update(query, updateVals, deferopt) → {Promise}

UPDATE a single document. If the document already exists, this will NOT update it.
Parameters:
Name Type Attributes Description
query Object
updateVals Object
defer Deferred <optional>
Source:
Returns:
Type
Promise

upsert(query, updateVals, deferopt) → {Promise}

UPSERT a single document.
Parameters:
Name Type Attributes Description
query Object
updateVals Object
defer Deferred <optional>
Source:
Returns:
Type
Promise