Constructor.
a reference to the collection to work agains
the name of this dynamic view
the options
Determines whether or not the callbacks associated with each event should happen in an async fashion or not. Default is false, which means events are synchronous
A map, with each property being an array of callbacks.
Alias of EventEmitter.on().
Adds or updates a filter in the DynamicView filter pipeline
A filter object to add to the pipeline. The object is in the format { 'type': filter_type, 'val', filter_param, 'uid', optional_filter_id }
this DynamicView object, for further chain ops.
applyFind() - Adds or updates a mongo-style query option in the DynamicView filter pipeline
A mongo-style query object to apply to pipeline
Optional: The unique ID of this filter, to reference it in the future.
this DynamicView object, for further chain ops.
Used to specify a property used for view translation.
the field name
boolean for sort descending or options object
this DynamicView object, for further chain ops.
Used to apply a sort by the latest full-text-search scoring.
Allows sorting a ResultSet based on multiple columns.
array of property names or subarray of [propertyname, isdesc] used evaluate sort order
Reference to this DynamicView, sorted, for future chain operations.
Adds or updates a javascript filter function in the DynamicView filter pipeline
A javascript filter function to apply to pipeline
Optional: The unique ID of this filter, to reference it in the future.
this DynamicView object, for further chain ops.
Makes a copy of the internal ResultSet for branched queries. Unlike this dynamic view, the branched ResultSet will not be 'live' updated, so your branched query should be immediately resolved and not held for future evaluation.
Optional name of collection transform, or an array of transform steps
optional parameters (if optional transform requires them)
A copy of the internal ResultSet for branched queries.
Commits a transaction.
this DynamicView object, for further chain ops.
Returns the number of documents representing the current DynamicView contents.
The number of documents representing the current DynamicView contents.
Resolves and pending filtering and sorting, then returns document array as result.
optional parameters to pass to ResultSet.data() if non-persistent
An array of documents representing the current DynamicView contents.
Emits a particular event with the option of passing optional parameters which are going to be processed by the callback provided signatures match (i.e. if passing emit(event, arg0, arg1) the listener should take two parameters)
the name of the event
optional object passed with the event
Returns the scoring of the last full-text-search.
Data transformation via user supplied functions
this function accepts a single document for you to transform and return
this function accepts many (array of map outputs) and returns single value
The output of your reduceFunction
Adds a listener to the queue of callbacks associated to an event
the name(s) of the event(s) to listen to
callback function of listener to attach
the index of the callback in the array of listeners for a particular event
Reapply all the filters in the current pipeline.
this DynamicView object, for further chain ops.
Remove the specified filter from the DynamicView filter pipeline
The unique ID of the filter to be removed.
this DynamicView object, for further chain ops.
Used to clear pipeline and reset dynamic view to initial state. Existing options should be retained.
Removes the listener at position 'index' from the event 'eventName'
the name(s) of the event(s) which the listener is attached to
the listener callback function to remove from emitter
Rolls back a transaction.
this DynamicView object, for further chain ops.
Marks the beginning of a transaction.
this DynamicView object, for further chain ops.
Override of toJSON to avoid circular references.
Generated using TypeDoc
DynamicView class is a versatile 'live' view class which can have filters and sorts applied. Collection.addDynamicView(name) instantiates this DynamicView object and notifies it whenever documents are add/updated/removed so it can remain up-to-date. (chainable)
let mydv = mycollection.addDynamicView('test'); // default is non-persistent mydv.applyFind({ 'doors' : 4 }); mydv.applyWhere(function(obj) { return obj.name === 'Toyota'; }); let results = mydv.data();
LokiEventEmitter
{@link Collection#addDynamicView} to construct instances of DynamicView
the data type
nested properties of data type