ChangeFeedPullModelIterator interface

Use Items.getChangeFeedIterator() to return an iterator that can iterate over all the changes for a partition key, feed range or an entire container.

Properties

hasMoreResults

Always returns true, changefeed is an infinite stream.

Methods

getAsyncIterator()

Gets an async iterator which will yield change feed results.

Example

Get changefeed for an entire container from now

const options = { changeFeedStartFrom: ChangeFeedStartFrom.Now() };
for await(const res of container.items.getChangeFeedIterator(options).getAsyncIterator()) {
  //process res
}
readNext()

Returns next set of results for the change feed.

Property Details

hasMoreResults

Always returns true, changefeed is an infinite stream.

hasMoreResults: boolean

Property Value

boolean

Method Details

getAsyncIterator()

Gets an async iterator which will yield change feed results.

Example

Get changefeed for an entire container from now

const options = { changeFeedStartFrom: ChangeFeedStartFrom.Now() };
for await(const res of container.items.getChangeFeedIterator(options).getAsyncIterator()) {
  //process res
}
function getAsyncIterator(): AsyncIterable<ChangeFeedIteratorResponse<(T & Resource)[]>>

Returns

AsyncIterable<ChangeFeedIteratorResponse<(T & Resource)[]>>

readNext()

Returns next set of results for the change feed.

function readNext(): Promise<ChangeFeedIteratorResponse<(T & Resource)[]>>

Returns