Lazy fetches

Queries that use the DBCollection.find() method return a DBCursor object, which represents a forward-only cursor that iterates over results. To fetch blocks of results that load as you demand them, use the DBCursor.lazyFetch() method. By default, queries fetch results eagerly, or all at once.

The purpose of lazy fetching is memory optimization. You must specify the lazy fetch before opening the cursor. It is important to close the cursor after fetching the results. Otherwise, memory leaks might occur.