Details
-
New Feature
-
Resolution: Done
-
Major - P3
-
None
-
None
Description
Current proposal is something like this:
public interface TailableCursor<T> extends MongoCursor<T> { |
/** |
Move to the next document if available, otherwise return null.
|
*/
|
T tryNext();
|
}
|
Normal usage would just use the existing MongoCursor interface (which extends Iterator and adds a close() method), but for users that don't want to block waiting for the next document, the non-blocking tryNext() method can be used, e.g.
while (true) { |
Document doc = cursor.tryNext();
|
// do other useful work here |
}
|