Suppose I've got very big collection and I select it by
MongoCursor<MyClass> answer = myCollection.find().as(MyClass.class);
Will Jongo/Mongo load whole collection at the first call or incrementally load data while I will iterate over answer?
Jongo's
MongoCursoruses Mongo's regularDBCursorunder the hood. TheDBCursorloads elements lazily (as typically all cursors do). I.e., your whole collection will not be loaded into memory, it will be lazily loaded while you iterate through your cursor.Relevant source from Jongo where
cursoris aDBCursor.