Parameters for the postChangesAsStream operation.

interface PostChangesAsStreamParams {
    attEncodingInfo?: boolean;
    attachments?: boolean;
    conflicts?: boolean;
    db: string;
    descending?: boolean;
    docIds?: string[];
    feed?: string;
    fields?: string[];
    filter?: string;
    headers?: OutgoingHttpHeaders;
    heartbeat?: number;
    includeDocs?: boolean;
    lastEventId?: string;
    limit?: number;
    selector?: JsonObject;
    seqInterval?: number;
    since?: string;
    style?: string;
    timeout?: number;
    view?: string;
}

Properties

attEncodingInfo?: boolean

Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.

attachments?: boolean

Query parameter to specify whether to include attachments bodies in a response.

conflicts?: boolean

Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.

db: string

Path parameter to specify the database name.

descending?: boolean

Query parameter to specify whether to return the documents in descending by key order.

docIds?: string[]

Schema for a list of document IDs.

feed?: string

Query parameter to specify the changes feed type.

fields?: string[]

JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted or empty, the entire document is returned.

filter?: string

Query parameter to specify a filter function from a design document that will filter the changes stream emitting only filtered events. For example: design_doc/filtername.

Additionally, some keywords are reserved for built-in filters:

  • _design - Returns only changes to design documents.
  • _doc_ids - Returns changes for documents with an ID matching one specified in doc_ids request body parameter.
  • _selector - Returns changes for documents that match the selector request body parameter. The selector syntax is the same as used for _find.
  • _view - Returns changes for documents that match an existing map function in the view specified by the query parameter view.
headers?: OutgoingHttpHeaders
heartbeat?: number

Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Off by default and only applicable for continuous and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. May also be true to use a value of 60000.

Note: Delivery of heartbeats cannot be relied on at specific intervals. If your application runs in an environment where idle network connections may break, heartbeat is not suitable as a keepalive mechanism. Instead, consider one of the following options:

  • Use the timeout parameter with a value that is compatible with your network environment.
  • Switch to scheduled usage of one of the non-continuous changes feed types (normal or longpoll).
  • Use TCP keepalive.
includeDocs?: boolean

Query parameter to specify whether to include the full content of the documents in the response.

lastEventId?: string

Header parameter to specify the ID of the last events received by the server on a previous connection. Overrides since query parameter.

limit?: number

Query parameter to specify the number of returned documents to limit the result to.

selector?: JsonObject

JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data.

The selector object must:

  • Be structured as valid JSON.
  • Contain a valid query expression.

Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only.

Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators.

Operators are identified by the use of a dollar sign $ prefix in the name field.

There are two core types of operators in the selector syntax:

  • Combination operators: applied at the topmost level of selection. They are used to combine selectors. A combination operator takes a single argument. The argument is either another selector, or an array of selectors.
  • Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. See the Cloudant Docs for a list of all available combination and conditional operators.
  • Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector.

For further reference see selector syntax.

seqInterval?: number

Query parameter to specify that the update seq should only be calculated with every Nth result returned. When fetching changes in a batch, setting seq_interval=<batch size>, where <batch size> is the number of results requested per batch, load can be reduced on the source database as computing the seq value across many shards (especially in highly-sharded databases) is expensive.

since?: string

Query parameter to specify to start the results from the change immediately after the given update sequence. Can be a valid update sequence or now value. Default is 0 i.e. all changes.

style?: string

Query parameter to specify how many revisions are returned in the changes array. The default, main_only, will only return the current "winning" revision; all_docs will return all leaf revisions (including conflicts and deleted former conflicts).

timeout?: number

Query parameter to specify the maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead connections.

view?: string

Query parameter to specify a view function as a filter. Documents pass the filter if the view's map function emits at least one record for them.

Generated using TypeDoc