Class: FdbDocument

FdbDocument

Document

Constructor

new FdbDocument()

Creates a new Document instance. Documents allow you to create individual objects that can have standard ForerunnerDB CRUD operations run against them, as well as data-binding if the AutoBind module is included in your project.
Source:

Members

(private) updateObject

Internal method for document updating.
Source:

Methods

(private) _isPositionalKey(key) → {Boolean}

Determines if the passed key has an array positional mark (a dollar at the end of its name).
Parameters:
Name Type Description
key String The key to check.
Source:
Returns:
True if it is a positional or false if not.
Type
Boolean

(private) _updateIncrement(doc, prop, val)

Increments a value for a property on a document by the passed number.
Parameters:
Name Type Description
doc Object The document to modify.
prop String The property to modify.
val Number The amount to increment by.
Source:

(private) _updateMultiply(doc, prop, val)

Multiplies a value for a property on a document by the passed number.
Parameters:
Name Type Description
doc Object The document to modify.
prop String The property to modify.
val Number The amount to multiply by.
Source:

(private) _updatePop(doc, val) → {Boolean}

Deletes a property on a document.
Parameters:
Name Type Description
doc Object The document to modify.
val * The property to delete.
Source:
Returns:
Type
Boolean

(private) _updateProperty(doc, prop, val)

Updates a property on an object depending on if the collection is currently running data-binding or not.
Parameters:
Name Type Description
doc Object The object whose property is to be updated.
prop String The property to update.
val * The new value of the property.
Source:

(private) _updatePull(arr, index)

Removes an item from the passed array.
Parameters:
Name Type Description
arr Array The array to modify.
index Number The index of the item in the array to remove.
Source:

(private) _updatePush(arr, doc)

Inserts an item at the end of an array.
Parameters:
Name Type Description
arr Array The array to insert the item into.
doc Object The document to insert.
Source:

(private) _updateRename(doc, prop, val)

Renames a property on a document to the passed property.
Parameters:
Name Type Description
doc Object The document to modify.
prop String The property to rename.
val Number The new property name.
Source:

(private) _updateSpliceMove(arr, indexFrom, indexTo)

Changes the index of an item in the passed array.
Parameters:
Name Type Description
arr Array The array to modify.
indexFrom Number The index to move the item from.
indexTo Number The index to move the item to.
Source:

(private) _updateSplicePush(arr, index, doc)

Inserts an item into the passed array at the specified index.
Parameters:
Name Type Description
arr Array The array to insert into.
index Number The index to insert at.
doc Object The document to insert.
Source:

(private) _updateUnset(doc, prop)

Deletes a property on a document.
Parameters:
Name Type Description
doc Object The document to modify.
prop String The property to delete.
Source:

update(query, update, optionsopt) → {Array}

Modifies the document. This will update the document with the data held in 'update'.
Parameters:
Name Type Attributes Description
query Object The query that must be matched for a document to be operated on.
update Object The object containing updated key/values. Any keys that match keys on the existing document will be overwritten with this data. Any keys that do not currently exist on the document will be added to the document.
options Object <optional>
An options object.
Source:
Returns:
The items that were updated.
Type
Array