Options
All
  • Public
  • Public/Protected
  • All
Menu

RemoteMongoCursor

RemoteMongoCursor is an iterator over documents, which allows asynchronous traversal.

A RemoteMongoCursor can be obtained from the result of a find or aggregate operation on a RemoteMongoCollection by calling RemoteMongoReadOperation.iterator.

Example

async function handleMovie(cursor) {
  const movie = await cursor.next()
  if (movie === undefined) {
    return
  }
  console.log(movie)
  // ... process and decide whether to keep iterating ...
  handleMovie(cursor)
}

// Work with the movies collection
const moviesCollection = db.collection('movieDetails')

moviesCollection
  .find({}, {limit: 10})
  .iterator()
  .then(handleMovie)

See Also

Type parameters

  • T

Hierarchy

  • RemoteMongoCursor

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Private proxy

proxy: Iterator<T>

Methods

next

  • next(): Promise<T | undefined>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc