Node.js - collection.query.stream()

Process query results as a stream.

import { collection } from '@nitric/sdk'

const profiles = collection('profiles').for('reading')

const profileQuery = profiles.query()

const results = await profileQuery.stream()

Examples

Streaming results from a query

import { collection } from '@nitric/sdk'

const profiles = collection('profiles').for('reading')

const profileQuery = profiles.query()

let results = await profileQuery.stream()

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

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

See also