Constructor
new DocSubscription(setup, connection)
Creates an instance of DocSubscription.
Parameters:
| Name | Type | Description |
|---|---|---|
setup |
Object | Configuration options for the subscription. |
connection |
Object | The connection object for managing the subscription. |
setup.doc |
Object | The document object associated with the subscription. |
setup.collectionName |
string | The name of the collection to which the document belongs. |
setup.filter |
Object | The filter object used to query the document from the collection. |
Members
collectionName :string
The name of the collection to which the document belongs.
Type:
- string
doc :Object
The document object associated with the subscription.
Type:
- Object
filter :Object
The filter object used to query the document from the collection.
Type:
- Object
type :string
Type identifier for the subscription (document).
Type:
- string
Methods
(async) handler() → {Object}
Handles the document subscription request by querying the database and initializing the document object.
Throws:
Will throw an error if the document retrieval or initialization fails.
Returns:
- The initialized document object.
- Type
- Object
(async) trigger() → {Object}
Triggers the subscription and sends the document data to the client.
Returns:
- The document object if found, or an error object if not found.
- Type
- Object