Cursor

module

  Cursor

since

  0.0.1

author

  Eduardo Astolfi eduardo.astolfi91@gmail.com

copyright

  2016 Eduardo Astolfi eduardo.astolfi91@gmail.com

license

  MIT Licensed

classdesc

  Cursor class that maps a MongoDB-like cursor

### Hierarchy

- Cursor

## Index

### Constructors

- constructor

### Properties

- cursor_pos
- db_objects
- documents
- fetch_mode
- fields
- indexes
- limitValue
- logger
- selector
- selector_compiled
- selector_id
- skipValue
- sortValue
- sort_compiled
- sorted
- COLSCAN
- IDXSCAN

### Methods

- batchSize
- close
- comment
- count
- explain
- fetch
- fetchAll
- fetchOne
- forEach
- hasNext
- hint
- itcount
- limit
- map
- max
- maxScan
- maxTimeMS
- min
- next
- noCursorTimeout
- objsLeftInBatch
- pretty
- readConcern
- readPref
- returnKey
- rewind
- setSorting
- showRecordId
- size
- skip
- snapshot
- sort
- tailable
- toArray
- project
- sort

## Constructors

### constructor

- new Cursor(documents: any, selection: any, fields?: any, options?: Object): Cursor

- - Defined in collection/Cursor.ts:57

  #### Parameters

  - ##### documents: any

    The list of documents

  - ##### selection: any

  - ##### Optional fields: any

  - ##### Default value options: Object = {}

  #### Returns Cursor

## Properties

### cursor_pos

cursor_pos: any

- Defined in collection/Cursor.ts:54

### db_objects

db_objects: any

- Defined in collection/Cursor.ts:53

### documents

documents: any

- Defined in collection/Cursor.ts:41

### fetch_mode

fetch_mode: any

- Defined in collection/Cursor.ts:50

### fields

fields: any

- Defined in collection/Cursor.ts:43

### indexes

indexes: any = null

- Defined in collection/Cursor.ts:51

### limitValue

limitValue: any

- Defined in collection/Cursor.ts:45

### Protected logger

logger: JSWLogger

- Defined in collection/Cursor.ts:39

### selector

selector: any

- Defined in collection/Cursor.ts:42

### selector_compiled

selector_compiled: any

- Defined in collection/Cursor.ts:48

### selector_id

selector_id: any

- Defined in collection/Cursor.ts:49

### skipValue

skipValue: any

- Defined in collection/Cursor.ts:44

### sortValue

sortValue: any

- Defined in collection/Cursor.ts:46

### sort_compiled

sort_compiled: any

- Defined in collection/Cursor.ts:52

### sorted

sorted: boolean = false

- Defined in collection/Cursor.ts:47

### Static COLSCAN

COLSCAN: string = "colscan"

- Defined in collection/Cursor.ts:56

### Static IDXSCAN

IDXSCAN: string = "idxscan"

- Defined in collection/Cursor.ts:57

## Methods

### batchSize

- batchSize(): void

- - Defined in collection/Cursor.ts:323
  todo

    Implement

  #### Returns void

### close

- close(): void

- - Defined in collection/Cursor.ts:331
  todo

    Implement

  #### Returns void

### comment

- comment(): void

- - Defined in collection/Cursor.ts:339
  todo

    Implement

  #### Returns void

### count

- count(): any

- - Defined in collection/Cursor.ts:234

  Obtains the total of documents of the cursor

  method

    Cursor#count

  #### Returns any

  The total of documents in the cursor

### explain

- explain(): void

- - Defined in collection/Cursor.ts:347
  todo

    Implement

  #### Returns void

### fetch

- fetch(): any

- - Defined in collection/Cursor.ts:201

  Alias for {@link Cursor#fetchAll}

  method

    Cursor#fetch

  #### Returns any

### fetchAll

- fetchAll(): any

- - Defined in collection/Cursor.ts:212

  Fetch all documents in the cursor

  method

    Cursor#fetchAll

  #### Returns any

  All the documents contained in the cursor

### fetchOne

- fetchOne(): any

- - Defined in collection/Cursor.ts:223

  Retrieves the next document in the cursor

  method

    Cursor#fetchOne

  #### Returns any

  The next document in the cursor

### forEach

- forEach(callback: any): void

- - Defined in collection/Cursor.ts:149

  Iterates over the cursor, calling a callback function

  method

    Cursor#forEach

  #### Parameters

  - ##### callback: any

  #### Returns void

### hasNext

- hasNext(): boolean

- - Defined in collection/Cursor.ts:183

  Checks if the cursor has one document to be fetched

  method

    Cursor#hasNext

  #### Returns boolean

  True if we can fetch one more document

### hint

- hint(): void

- - Defined in collection/Cursor.ts:355
  todo

    Implement

  #### Returns void

### itcount

- itcount(): void

- - Defined in collection/Cursor.ts:363
  todo

    Implement

  #### Returns void

### limit

- limit(limit: any): this

- - Defined in collection/Cursor.ts:312

  Set the max number of document to fetch

  method

    Cursor#limit

  #### Parameters

  - ##### limit: any

    The max number of documents

  #### Returns this

  This instance so it can be chained with other methods

### map

- map(callback: any): Array<any>

- - Defined in collection/Cursor.ts:166

  Iterates over the cursor, returning a new array with the documents affected by the callback function

  method

    Cursor#map

  #### Parameters

  - ##### callback: any

  #### Returns Array<any>

  The documents after being affected with the callback function

### max

- max(): void

- - Defined in collection/Cursor.ts:387
  todo

    Implement

  #### Returns void

### maxScan

- maxScan(): void

- - Defined in collection/Cursor.ts:371
  todo

    Implement

  #### Returns void

### maxTimeMS

- maxTimeMS(): void

- - Defined in collection/Cursor.ts:379
  todo

    Implement

  #### Returns void

### min

- min(): void

- - Defined in collection/Cursor.ts:395
  todo

    Implement

  #### Returns void

### next

- next(): any

- - Defined in collection/Cursor.ts:192

  Alias for {@link Cursor#fetchOne}

  method

    Cursor#next

  #### Returns any

### noCursorTimeout

- noCursorTimeout(): void

- - Defined in collection/Cursor.ts:403
  todo

    Implement

  #### Returns void

### objsLeftInBatch

- objsLeftInBatch(): void

- - Defined in collection/Cursor.ts:411
  todo

    Implement

  #### Returns void

### pretty

- pretty(): void

- - Defined in collection/Cursor.ts:419
  todo

    Implement

  #### Returns void

### readConcern

- readConcern(): void

- - Defined in collection/Cursor.ts:427
  todo

    Implement

  #### Returns void

### readPref

- readPref(): void

- - Defined in collection/Cursor.ts:435
  todo

    Implement

  #### Returns void

### returnKey

- returnKey(): void

- - Defined in collection/Cursor.ts:443
  todo

    Implement

  #### Returns void

### rewind

- rewind(): void

- - Defined in collection/Cursor.ts:137

  Moves a cursor to the begining

  method

    Cursor#rewind

  #### Returns void

### setSorting

- setSorting(spec: any): this

- - Defined in collection/Cursor.ts:247

  Set the sorting of the cursor

  method

    Cursor#sort

  #### Parameters

  - ##### spec: any

    The sorting specification

  #### Returns this

  This instance so it can be chained with other methods

### showRecordId

- showRecordId(): void

- - Defined in collection/Cursor.ts:451
  todo

    Implement

  #### Returns void

### size

- size(): void

- - Defined in collection/Cursor.ts:459
  todo

    Implement

  #### Returns void

### skip

- skip(skip: any): this

- - Defined in collection/Cursor.ts:295

  Set the number of document to skip when fetching the cursor

  method

    Cursor#skip

  #### Parameters

  - ##### skip: any

    The number of documents to skip

  #### Returns this

  This instance so it can be chained with other methods

### snapshot

- snapshot(): void

- - Defined in collection/Cursor.ts:467
  todo

    Implement

  #### Returns void

### sort

- sort(spec: any): this

- - Defined in collection/Cursor.ts:267

  Applies a sorting on the cursor

  method

    Cursor#sort

  #### Parameters

  - ##### spec: any

    The sorting specification

  #### Returns this

  This instance so it can be chained with other methods

### tailable

- tailable(): void

- - Defined in collection/Cursor.ts:476
  todo

    Implement

  #### Returns void

### toArray

- toArray(): void

- - Defined in collection/Cursor.ts:484
  todo

    Implement

  #### Returns void

### Static project

- project(doc: any, spec: any, aggregation?: boolean): any

- - Defined in collection/Cursor.ts:503

  Projects the fields of one or several documents, changing the output

  method

    Cursor.project

  #### Parameters

  - ##### doc: any

    The document/s that will be projected

  - ##### spec: any

    Fields projection specification. Can be an space/comma separated list, an array, or an object

  - ##### Default value aggregation: boolean = false

  #### Returns any

  The document/s after the projection

### Static sort

- sort(doc: any, fields: any): void

- - Defined in collection/Cursor.ts:489

  #### Parameters

  - ##### doc: any

  - ##### fields: any

  #### Returns void

Generated using TypeDoc