classafMongo::MongoCur

sys::Obj
  afMongo::MongoCur
batchSize

Source

Int? batchSize

A configurable batch size.

null indicates a Mongo default of 101.

colName

Source

const Str colName

The collection this cursor iterates over.

connMgr

Source

const MongoConnMgr connMgr

The underlying connection manager.

cursorId

Source

Int cursorId { private set }

The cursor ID.

dbName

Source

const Str dbName

The database this cursor iterates in.

each

Source

Void each(|Str:Obj?,Int fn)

Iterates over all remaining and unread documents.

This cursor is guaranteed to be killed.

cursor.each |Str:Obj? doc, Int index| {
    ...
}
index

Source

Int index()

Returns the current index of the last document.

isAlive

Source

Bool isAlive()

Returns true if the cursor is alive on the server or more documents may be read.

kill

Source

Void kill()

Kills this cursor.

No more documents will be returned from next(), each(), or toList().

make

Source

new make(MongoConnMgr connMgr, Str dbName, Str colName, Int cursorId, Str:Obj?[]? firstBatch := null, Obj? session := null)

Creates a new Mongo Cursor with a first batch

map

Source

Obj?[] map(|Str:Obj?,Int->Obj? fn)

Converts all remaining and unread documents to a List. The new list is typed based on the return type of the function.

This cursor is guaranteed to be killed.

list := cursor.map |Str:Obj? doc, Int index -> Obj?| {
    ...
}
maxTime

Source

Duration? maxTime

A configurable timeout for Mongo server operations.

null indicates a Mongo default of forever.

Source

[Str:Obj?]? next()

Returns the next document from the cursor, or null.

The cursor must be manually killed.

while (cursor.isAlive) {
    doc := cursor.next
    ...
}
cursor.kill
toList

Source

Str:Obj?[] toList()

Return all remaining and unread documents as a List.

This cursor is guaranteed to be killed.

Returns an empty list should the cursor be killed.