Class: DocSubscription

DocSubscription(setup, connection)

Represents a subscription for a specific document in a collection. Extends SocketSubscription class.

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.

Source:

Members

collectionName :string

The name of the collection to which the document belongs.

Type:
  • string
Source:

doc :Object

The document object associated with the subscription.

Type:
  • Object
Source:

filter :Object

The filter object used to query the document from the collection.

Type:
  • Object
Source:

type :string

Type identifier for the subscription (document).

Type:
  • string
Source:

Methods

(async) handler() → {Object}

Handles the document subscription request by querying the database and initializing the document object.

Source:
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.

Source:
Returns:
  • The document object if found, or an error object if not found.
Type
Object