MongoCursor.limit

MongoCursor limit(long count)

Limits the number of documents that the cursor returns.

This method must be called before beginning iteration in order to have effect. If multiple calls to limit() are made, the one with the lowest limit will be chosen.

Parameters

countThe maximum number number of documents to return. A value of zero means unlimited.

Returns

the same cursor

See Also