classafMongo::MongoCur
sys::Obj afMongo::MongoCur
Mongo Cursors iterate over Collection data.
@See
- batchSize
- Int? batchSize- A configurable batch size. - nullindicates a Mongo default of- 101.
- colName
- const Str colName- The collection this cursor iterates over. 
- connMgr
- const MongoConnMgr connMgr- The underlying connection manager. 
- cursorId
- Int cursorId { private set }- The cursor ID. 
- dbName
- const Str dbName- The database this cursor iterates in. 
- each
- Iterates over all remaining and unread documents. - This cursor is guaranteed to be killed. - cursor.each |Str:Obj? doc, Int index| { ... }
- index
- Int index()- Returns the current index of the last document. 
- isAlive
- Bool isAlive()- Returns - trueif the cursor is alive on the server or more documents may be read.
- kill
- Void kill()- Kills this cursor. - No more documents will be returned from - next(),- each(), or- toList().
- make
- 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
- 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
- Duration? maxTime- A configurable timeout for Mongo server operations. - nullindicates a Mongo default of forever.
- 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
- 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.