Nitric logo

Collections

collection.query.stream()

Process query results as a stream.

import { collection } from '@nitric/sdk';

const profiles = collection('profiles');

const profileQuery = profiles.query();

const results = await profileQuery.stream();

Examples

Streaming results from a query

import { collection } from '@nitric/sdk';

const profiles = collection('profiles');

const profileQuery = profiles.query();

let results = await profileQuery.stream();

results.on('data', (doc) => {
  // handle stream results
});

results.on('end', () => {
  // handle stream closing
});

See also

Previous
collection.query.fetch()