Trait/Object

io.scalajs.npm.mongodb

Cursor

Related Docs: object Cursor | package mongodb

Permalink

trait Cursor[T] extends Object with Readable

Cursor

Annotations
@RawJSType() @native()
See also

https://mongodb.github.io/node-mongodb-native/api-generated/cursor.html
Linear Supertypes
Readable, IEventEmitter, Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Cursor
  2. Readable
  3. IEventEmitter
  4. Object
  5. Any
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def _read(size: Int): Unit

    Permalink
    Definition Classes
    Readable
  5. var _read: Function

    Permalink
    Definition Classes
    Readable
  6. def _readableState: ReadableState

    Permalink
    Definition Classes
    Readable
  7. def addCursorFlag(flag: CursorFlag, value: Boolean): Cursor.this.type

    Permalink

    Add a cursor flag to the cursor

    Add a cursor flag to the cursor

    flag

    The flag to set, must be one of following ['tailable', 'oplogReplay', 'noCursorTimeout', 'awaitData', 'partial'].

    value

    The flag boolean value.

  8. def addListener(eventName: String, listener: Function): Cursor.this.type

    Permalink
    Definition Classes
    IEventEmitter
  9. def addQueryModifier(name: String, value: Boolean): Cursor.this.type

    Permalink

    Add a query modifier to the cursor query

    Add a query modifier to the cursor query

    name

    The query modifier (must start with $, such as $orderby etc)

    value

    The flag boolean value.

  10. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  11. def batchSize(size: Int, callback: MongoCallback1[Cursor.this.type] = js.native): Promise[Cursor.this.type]

    Permalink

    Sets the batch size parameter of this cursor to the given value.

    Sets the batch size parameter of this cursor to the given value.

    size

    the new batch size.

    callback

    this optional callback will be called after executing this method. The first parameter will contain an error object when the batchSize given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.

    returns

    a promise of the Cursor if the callback was not passed

    Example:
    1. batchSize(size[, callback])

  12. def clone(): Cursor.this.type

    Permalink

    Clone the cursor

    Clone the cursor

    Definition Classes
    Cursor → AnyRef
  13. def close(callback: MongoCallback1[Cursor.this.type] = js.native): Promise[Cursor.this.type]

    Permalink

    Close the cursor, sending a KillCursor command and emitting close.

    Close the cursor, sending a KillCursor command and emitting close.

    callback

    this will be called after executing this method. The first parameter will always contain null while the second parameter will contain a reference to this cursor.

    returns

    a promise of the Cursor if the callback was not passed

  14. def collation(value: Any): Cursor.this.type

    Permalink

    Set the collation options for the cursor.

    Set the collation options for the cursor.

    value

    the cursor collation options (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields).

    returns

    the Cursor

  15. def comment(value: String): Cursor.this.type

    Permalink

    Add a comment to the cursor query allowing for tracking the comment in the log.

    Add a comment to the cursor query allowing for tracking the comment in the log.

    value

    The comment attached to this query.

    returns

    the Cursor

  16. def count(applySkipLimit: Boolean, callback: MongoCallback1[Int]): Promise[Int]

    Permalink

    Determines how many result the query for this cursor will return

    Determines how many result the query for this cursor will return

    applySkipLimit

    if set to true will apply the skip and limits set on the cursor. Defaults to false.

    callback

    this will be called after executing this method. The first parameter will contain the Error object if an error occurred, or null otherwise. While the second parameter will contain the number of results or null if an error occurred.

    returns

    a promise of the count if the callback was not passed

    Example:
    1. count(applySkipLimit, [options], [callback])

  17. def count(applySkipLimit: Boolean, options: |[CountOptions, RawOptions], callback: MongoCallback1[Int]): Promise[Int]

    Permalink

    Determines how many result the query for this cursor will return

    Determines how many result the query for this cursor will return

    applySkipLimit

    if set to true will apply the skip and limits set on the cursor. Defaults to false.

    options

    the optional settings.

    callback

    this will be called after executing this method. The first parameter will contain the Error object if an error occurred, or null otherwise. While the second parameter will contain the number of results or null if an error occurred.

    returns

    a promise of the count if the callback was not passed

    Example:
    1. count(applySkipLimit, [options], [callback])

  18. var domain: String

    Permalink
    Definition Classes
    IEventEmitter
  19. def emit(name: String, args: Any*): Any

    Permalink
    Definition Classes
    IEventEmitter
  20. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  21. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  22. def explain(callback: Function): Unit

    Permalink

    Gets a detailed information about how the query is performed on this cursor and how long it took the database to process it.

    Gets a detailed information about how the query is performed on this cursor and how long it took the database to process it.

    callback

    this will be called after executing this method. The first parameter will always be null while the second parameter will be an object containing the details.

    Example:
    1. explain(callback)

  23. def filter(filter: Any): Cursor.this.type

    Permalink

    Set the cursor query

    Set the cursor query

    filter

    The filter object used for the cursor.

  24. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  25. def forEach(iterator: Function1[T, Any], callback: MongoCallback1[T]): Unit

    Permalink

    Iterates over all the documents for this cursor using the iterator, callback pattern.

    Iterates over all the documents for this cursor using the iterator, callback pattern.

    iterator

    The iteration callback.

    callback

    The end callback.

  26. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  27. def getMaxListeners(): Int

    Permalink
    Definition Classes
    IEventEmitter
  28. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  29. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  30. def hint(hint: String = js.native): Cursor.this.type

    Permalink

    Set the cursor hint

    Set the cursor hint

    hint

    If specified, then the query system will only consider plans using the hinted index.

  31. def isClosed(): Boolean

    Permalink

    Check if the cursor is closed or open.

    Check if the cursor is closed or open.

    returns

    the state of the cursor.

  32. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  33. def isPaused(): Boolean

    Permalink
    Definition Classes
    Readable
  34. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  35. def limit(value: Int): Cursor.this.type

    Permalink

    Sets the limit parameter of this cursor to the given value.

    Sets the limit parameter of this cursor to the given value.

    value

    The limit for the cursor query.

    returns

    the Cursor

  36. def listenerCount(eventName: String): Int

    Permalink
    Definition Classes
    IEventEmitter
  37. def listeners(eventName: String): Array[Function]

    Permalink
    Definition Classes
    IEventEmitter
  38. def map(transform: Function): Unit

    Permalink

    Map all documents using the provided function

    Map all documents using the provided function

    transform

    The mapping transformation method.

  39. def max(max: Int): Cursor.this.type

    Permalink

    Set the cursor max

    Set the cursor max

    max

    Specify a $max value to specify the exclusive upper bound for a specific index in order to constrain the results of find(). The $max specifies the upper bound for all keys of a specific index in order.

  40. def maxAwaitTimeMS(value: Int): Cursor.this.type

    Permalink

    Set a maxAwaitTimeMS on a tailing cursor query to allow to customize the timeout value for the option awaitData (Only supported on MongoDB 3.2 or higher, ignored otherwise)

    Set a maxAwaitTimeMS on a tailing cursor query to allow to customize the timeout value for the option awaitData (Only supported on MongoDB 3.2 or higher, ignored otherwise)

    value

    Number of milliseconds to wait before aborting the tailed query.

  41. def maxScan(maxScan: Int): Cursor.this.type

    Permalink

    Set the cursor maxScan

    Set the cursor maxScan

    maxScan

    Constrains the query to only scan the specified number of documents when fulfilling the query

  42. def maxTimeMS(maxTimeMS: Int, callback: Function = js.native): Cursor.this.type

    Permalink

    Specifies a time limit for a query operation.

    Specifies a time limit for a query operation. After the specified time is exceeded, the operation will be aborted and an error will be returned to the client. If maxTimeMS is null, no limit is applied.

    maxTimeMS

    the maxTimeMS for the query.

    callback

    this optional callback will be called after executing this method. The first parameter will contain an error object when the limit given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.

    Example:
    1. maxTimeMS(maxTimeMS[, callback])

  43. def min(min: Int): Cursor.this.type

    Permalink

    Set the cursor min

    Set the cursor min

    min

    Specify a $min value to specify the inclusive lower bound for a specific index in order to constrain the results of find(). The $min specifies the lower bound for all keys of a specific index in order.

  44. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  45. def next(callback: MongoCallback1[T] = js.native): Promise[T]

    Permalink

    Get the next available document from the cursor, returns null if no more documents are available.

    Get the next available document from the cursor, returns null if no more documents are available.

    callback

    The result callback.

    returns

    promise if no callback passed

  46. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  47. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  48. def on(eventName: String, listener: Function): Cursor.this.type

    Permalink
    Definition Classes
    IEventEmitter
  49. def once(eventName: String, listener: Function): Cursor.this.type

    Permalink
    Definition Classes
    IEventEmitter
  50. def pause(): Cursor.this.type

    Permalink
    Definition Classes
    Readable
  51. def pipe(destination: Writable, options: |[ReadablePipeOptions, RawOptions]): Cursor.this.type

    Permalink
    Definition Classes
    Readable
  52. def project(value: Any): Cursor.this.type

    Permalink

    Sets a field projection for the query.

    Sets a field projection for the query.

    value

    The field projection object.

  53. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  54. def push(chunk: Buffer): Boolean

    Permalink
    Definition Classes
    Readable
  55. def push(chunk: String, encoding: String): Boolean

    Permalink
    Definition Classes
    Readable
  56. def read[T](size: Int): T

    Permalink
    Definition Classes
    Readable
  57. def removeAllListeners(): Cursor.this.type

    Permalink
    Definition Classes
    IEventEmitter
  58. def removeAllListeners(eventName: String): Cursor.this.type

    Permalink
    Definition Classes
    IEventEmitter
  59. def removeListener(eventName: String, listener: Function): Cursor.this.type

    Permalink
    Definition Classes
    IEventEmitter
  60. def resume(): Cursor.this.type

    Permalink
    Definition Classes
    Readable
  61. def returnKey(returnKey: Int): Cursor.this.type

    Permalink

    Set the cursor returnKey

    Set the cursor returnKey

    returnKey

    Only return the index field or fields for the results of the query. If $returnKey is set to true and the query does not use an index to perform the read operation, the returned documents will not contain any fields.

  62. def rewind(): Cursor.this.type

    Permalink

    Resets this cursor to its initial state.

    Resets this cursor to its initial state. All settings like the query string, tailable, batchSizeValue, skipValue and limits are preserved.

  63. def setEncoding(encoding: String): Cursor.this.type

    Permalink
    Definition Classes
    Readable
  64. def setMaxListeners(n: Int): Cursor.this.type

    Permalink
    Definition Classes
    IEventEmitter
  65. def setReadPreference(readPreference: |[ReadPreference, String]): Cursor.this.type

    Permalink

    Sets the read preference for the cursor

    Sets the read preference for the cursor

    readPreference

    The new read preference for the cursor.

    Example:
    1. setReadPreference(pref)

  66. def showRecordId(enable: Boolean): Cursor.this.type

    Permalink

    Set the cursor showRecordId

    Set the cursor showRecordId

    enable

    The $showDiskLoc option has now been deprecated and replaced with the showRecordId field. $showDiskLoc will still be accepted for OP_QUERY stye find.

    returns

    the Cursor

  67. def skip(value: Int): Cursor.this.type

    Permalink

    Set the skip for the cursor.

    Set the skip for the cursor.

    value

    The skip for the cursor query.

    returns

    the Cursor

  68. def snapshot(enable: Boolean): Cursor.this.type

    Permalink

    TODO document me

  69. def snapshot(snapshot: Any): Cursor.this.type

    Permalink

    Set the cursor snapshot

    Set the cursor snapshot

    snapshot

    The $snapshot operator prevents the cursor from returning a document more than once because an intervening write operation results in a move of the document.

    returns

    the Cursor

  70. def sort(keyOrList: |[String, Array[Any]], direction: |[Int, String]): Cursor.this.type

    Permalink

    Sets the sort parameter of this cursor to the given value.

    Sets the sort parameter of this cursor to the given value.

    keyOrList

    this can be a string or an array. If passed as a string, the string will be the field to sort. If passed an array, each element will represent a field to be sorted and should be an array that contains the format [string, direction].

    direction

    this determines how the results are sorted. "asc", "ascending" or 1 for ascending order while "desc", "descending or -1 for descending order. Note that the strings are case insensitive.

    Example:
    1. sort(keyOrList, direction, callback)

  71. def sort(keyOrList: Array[Any], callback: Function = js.native): Cursor.this.type

    Permalink

    Sets the sort parameter of this cursor to the given value.

    Sets the sort parameter of this cursor to the given value.

    keyOrList

    this can be a string or an array. If passed as a string, the string will be the field to sort. If passed an array, each element will represent a field to be sorted and should be an array that contains the format [string, direction].

    callback

    this will be called after executing this method. The first parameter will contain an error object when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.

    Example:
    1. sort(keyOrList, direction, callback)

  72. def sort(keyOrList: String, direction: |[Int, String], callback: Function): Cursor.this.type

    Permalink

    Sets the sort parameter of this cursor to the given value.

    Sets the sort parameter of this cursor to the given value.

    keyOrList

    this can be a string or an array. If passed as a string, the string will be the field to sort. If passed an array, each element will represent a field to be sorted and should be an array that contains the format [string, direction].

    direction

    this determines how the results are sorted. "asc", "ascending" or 1 for ascending order while "desc", "descending or -1 for descending order. Note that the strings are case insensitive.

    callback

    this will be called after executing this method. The first parameter will contain an error object when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.

    Example:
    1. sort(keyOrList, direction, callback)

  73. def stream(options: CursorStreamOptions = js.native): Readable

    Permalink

    Return a modified Readable stream including a possible transform method.

    Return a modified Readable stream including a possible transform method.

    options

    the optional settings

    returns

    returns a Cursor.

  74. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  75. def toArray(callback: MongoCallback1[Array[T]] = js.native): Promise[Array[T]]

    Permalink

    Returns an array of documents.

    Returns an array of documents. The caller is responsible for making sure that there is enough memory to store the results. Note that the array only contain partial results when this cursor had been previously accessed. In that case, cursor.rewind() can be used to reset the cursor.

    callback

    This will be called after executing this method successfully. The first parameter will contain the Error object if an error occurred, or null otherwise. The second parameter will contain an array of BSON deserialized objects as a result of the query.

  76. def toLocaleString(): String

    Permalink
    Definition Classes
    Object
  77. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  78. def unpipe(destination: Writable): Unit

    Permalink
    Definition Classes
    Readable
  79. def unshift(chunk: Any): Unit

    Permalink
    Definition Classes
    Readable
  80. var usingDomains: Boolean

    Permalink
    Definition Classes
    IEventEmitter
  81. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  82. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  83. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  84. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  85. def wrap(stream: Any): Unit

    Permalink
    Definition Classes
    Readable

Deprecated Value Members

  1. def each(callback: MongoCallback1[T]): Unit

    Permalink

    Iterates over all the documents for this cursor.

    Iterates over all the documents for this cursor. As with {cursor.toArray}, not all of the elements will be iterated if this cursor had been previouly accessed. In that case, {cursor.rewind} can be used to reset the cursor. However, unlike {cursor.toArray}, the cursor will only hold a maximum of batch size elements at any given time if batch size is specified. Otherwise, the caller is responsible for making sure that the entire result can fit the memory.

    callback

    this will be called for while iterating every document of the query result. The first parameter will contain the Error object if an error occurred, or null otherwise. While the second parameter will contain the document.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.2) No alternatives specified

  2. def nextObject(callback: MongoCallback1[T] = js.native): Promise[T]

    Permalink

    Gets the next document from the cursor.

    Gets the next document from the cursor.

    callback

    The result callback.

    returns

    promise if no callback passed

    Annotations
    @deprecated
    Deprecated

    (Since version 2.0) Use next() instead

Inherited from Readable

Inherited from IEventEmitter

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped