Options
All
  • Public
  • Public/Protected
  • All
Menu

Creates a new Cursor instance (INTERNAL TYPE, do not instantiate directly).

see

http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html

Type parameters

  • T

Hierarchy

  • Readable
    • Cursor

Implements

  • ReadableStream

Index

Constructors

constructor

  • new Cursor(opts?: ReadableOptions): Cursor
  • Parameters

    • Optional opts: ReadableOptions

    Returns Cursor

Properties

readPreference

readPreference: ReadPreference

Get cursor ReadPreference.

readable

readable: boolean

readableHighWaterMark

readableHighWaterMark: number

readableLength

readableLength: number

sortValue

sortValue: string

Cursor query sort setting.

timeout

timeout: boolean

Is Cursor able to time out.

Static defaultMaxListeners

defaultMaxListeners: number

Methods

_destroy

  • _destroy(err: Error, callback: Function): void
  • Parameters

    • err: Error
    • callback: Function

    Returns void

_read

  • _read(size: number): void
  • Parameters

    • size: number

    Returns void

addCursorFlag

  • addCursorFlag(flag: string, value: boolean): Cursor<T>

addListener

  • addListener(event: string, listener: function): this
  • addListener(event: "close", listener: function): this
  • addListener(event: "data", listener: function): this
  • addListener(event: "end", listener: function): this
  • addListener(event: "readable", listener: function): this
  • addListener(event: "error", listener: function): this
  • Event emitter The defined events on documents including:

    1. close
    2. data
    3. end
    4. readable
    5. error

    Parameters

    • event: string
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "data"
    • listener: function
        • (chunk: Buffer | string): void
        • Parameters

          • chunk: Buffer | string

          Returns void

    Returns this

  • Parameters

    • event: "end"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "readable"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns this

addQueryModifier

  • addQueryModifier(name: string, value: boolean): Cursor<T>

batchSize

  • batchSize(value: number): Cursor<T>

clone

close

comment

  • comment(value: string): Cursor<T>

count

destroy

  • destroy(error?: Error): void
  • Parameters

    Returns void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • emit(event: "close"): boolean
  • emit(event: "data", chunk: Buffer | string): boolean
  • emit(event: "end"): boolean
  • emit(event: "readable"): boolean
  • emit(event: "error", err: Error): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

  • Parameters

    • event: "close"

    Returns boolean

  • Parameters

    • event: "data"
    • chunk: Buffer | string

    Returns boolean

  • Parameters

    • event: "end"

    Returns boolean

  • Parameters

    • event: "readable"

    Returns boolean

  • Parameters

    • event: "error"
    • err: Error

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

explain

filter

  • filter(filter: Object): Cursor<T>

forEach

getMaxListeners

  • getMaxListeners(): number
  • Returns number

hasNext

  • hasNext(): Promise<boolean>
  • hasNext(callback: MongoCallback<boolean>): void

hint

  • hint(hint: Object): Cursor<T>

isClosed

  • isClosed(): boolean

isPaused

  • isPaused(): boolean
  • Returns boolean

limit

  • limit(value: number): Cursor<T>

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

map

  • map(transform: Function): Cursor<T>

max

maxAwaitTimeMS

  • maxAwaitTimeMS(value: number): Cursor<T>

maxScan

  • maxScan(maxScan: Object): Cursor<T>

maxTimeMS

  • maxTimeMS(value: number): Cursor<T>

min

next

on

  • on(event: string, listener: function): this
  • on(event: "close", listener: function): this
  • on(event: "data", listener: function): this
  • on(event: "end", listener: function): this
  • on(event: "readable", listener: function): this
  • on(event: "error", listener: function): this
  • Parameters

    • event: string
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "data"
    • listener: function
        • (chunk: Buffer | string): void
        • Parameters

          • chunk: Buffer | string

          Returns void

    Returns this

  • Parameters

    • event: "end"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "readable"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns this

once

  • once(event: string, listener: function): this
  • once(event: "close", listener: function): this
  • once(event: "data", listener: function): this
  • once(event: "end", listener: function): this
  • once(event: "readable", listener: function): this
  • once(event: "error", listener: function): this
  • Parameters

    • event: string
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "data"
    • listener: function
        • (chunk: Buffer | string): void
        • Parameters

          • chunk: Buffer | string

          Returns void

    Returns this

  • Parameters

    • event: "end"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "readable"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns this

pause

  • pause(): this
  • Returns this

pipe

  • pipe<T>(destination: T, options?: undefined | object): T
  • Type parameters

    • T: WritableStream

    Parameters

    • destination: T
    • Optional options: undefined | object

    Returns T

prependListener

  • prependListener(event: string, listener: function): this
  • prependListener(event: "close", listener: function): this
  • prependListener(event: "data", listener: function): this
  • prependListener(event: "end", listener: function): this
  • prependListener(event: "readable", listener: function): this
  • prependListener(event: "error", listener: function): this
  • Parameters

    • event: string
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "data"
    • listener: function
        • (chunk: Buffer | string): void
        • Parameters

          • chunk: Buffer | string

          Returns void

    Returns this

  • Parameters

    • event: "end"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "readable"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string, listener: function): this
  • prependOnceListener(event: "close", listener: function): this
  • prependOnceListener(event: "data", listener: function): this
  • prependOnceListener(event: "end", listener: function): this
  • prependOnceListener(event: "readable", listener: function): this
  • prependOnceListener(event: "error", listener: function): this
  • Parameters

    • event: string
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "data"
    • listener: function
        • (chunk: Buffer | string): void
        • Parameters

          • chunk: Buffer | string

          Returns void

    Returns this

  • Parameters

    • event: "end"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "readable"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns this

project

  • project(value: Object): Cursor<T>

push

  • push(chunk: any, encoding?: undefined | string): boolean
  • Parameters

    • chunk: any
    • Optional encoding: undefined | string

    Returns boolean

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

read

  • read(size: number): string | Buffer | void

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string, listener: function): this
  • removeListener(event: "close", listener: function): this
  • removeListener(event: "data", listener: function): this
  • removeListener(event: "end", listener: function): this
  • removeListener(event: "readable", listener: function): this
  • removeListener(event: "error", listener: function): this
  • Parameters

    • event: string
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "data"
    • listener: function
        • (chunk: Buffer | string): void
        • Parameters

          • chunk: Buffer | string

          Returns void

    Returns this

  • Parameters

    • event: "end"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "readable"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns this

resume

  • resume(): this
  • Returns this

returnKey

  • returnKey(returnKey: Object): Cursor<T>

rewind

  • rewind(): void

setCursorOption

  • setCursorOption(field: string, value: Object): Cursor<T>

setEncoding

  • setEncoding(encoding: string): this
  • Parameters

    • encoding: string

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

setReadPreference

showRecordId

  • showRecordId(showRecordId: Object): Cursor<T>

skip

  • skip(value: number): Cursor<T>

snapshot

  • snapshot(snapshot: Object): Cursor<T>

sort

  • sort(keyOrList: string | Object[] | Object, direction?: undefined | number): Cursor<T>

stream

  • stream(options?: undefined | object): Cursor<T>

toArray

  • toArray(): Promise<T[]>
  • toArray(callback: MongoCallback<T[]>): void

unpipe

  • unpipe<T>(destination?: T): this
  • Type parameters

    • T: WritableStream

    Parameters

    • Optional destination: T

    Returns this

unshift

  • unshift(stream: Buffer | string): void

wrap

  • wrap(oldStream: ReadableStream): this
  • Parameters

    • oldStream: ReadableStream

    Returns this

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc