classafMorphia::MorphiaCur
sys::Obj afMorphia::MorphiaCur
Morphio Cursors wrap Mongo cursors to return entity objects.
- bsonConvs
BsonConvs bsonConvs
Used to convert BSON documents to Fantom objects.
- each
Iterates over all remaining and unread documents.
This cursor is guaranteed to be killed.
cursor.each |Obj entity, Int index| { ... }
- isAlive
Bool isAlive()
Returns
true
if the cursor is alive on the server or more documents may be read.- kill
Void kill()
Kills this cursor.
No more entities will be returned from
next()
,each()
, ortoList()
.- make
new make(MongoCur mongoCur, Type type, BsonConvs bsonConvs)
Creates a new Morphia Cursor.
- map
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 |Obj entity, Int index -> Obj?| { ... }
- mongoCur
MongoCur mongoCur { private set }
The backing Mongo cursor.
- next
Obj? next()
Returns the next entity from the cursor, or
null
.The cursor must be manually killed.
while (cursor.isAlive) { entity := cursor.next ... } cursor.kill
- toList
Obj[] toList()
Return all remaining and unread entities as a List.
This cursor is guaranteed to be killed.
- type
Type type
The Fantom type that objects are returned as.