Interface CursorPreparer
- All Superinterfaces:
ReadPreferenceAware
Simple callback interface to allow customization of a
FindIterable
.- Author:
- Oliver Gierke, Christoph Strobl
-
Field Summary
Modifier and TypeFieldDescriptionstatic final CursorPreparer
DefaultCursorPreparer
just passing on the givenFindIterable
. -
Method Summary
Modifier and TypeMethodDescriptiondefault com.mongodb.ReadPreference
default com.mongodb.client.FindIterable<org.bson.Document>
initiateFind
(com.mongodb.client.MongoCollection<org.bson.Document> collection, Function<com.mongodb.client.MongoCollection<org.bson.Document>, com.mongodb.client.FindIterable<org.bson.Document>> find) Apply query specific settings toMongoCollection
and initiate a find operation returning aFindIterable
via the givenfind
function.com.mongodb.client.FindIterable<org.bson.Document>
prepare
(com.mongodb.client.FindIterable<org.bson.Document> iterable) Prepare the given cursor (apply limits, skips and so on).Methods inherited from interface org.springframework.data.mongodb.core.ReadPreferenceAware
hasReadPreference
-
Field Details
-
NO_OP_PREPARER
DefaultCursorPreparer
just passing on the givenFindIterable
.- Since:
- 2.2
-
-
Method Details
-
prepare
com.mongodb.client.FindIterable<org.bson.Document> prepare(com.mongodb.client.FindIterable<org.bson.Document> iterable) Prepare the given cursor (apply limits, skips and so on). Returns the prepared cursor.- Parameters:
iterable
- must not be null.- Returns:
- never null.
-
initiateFind
default com.mongodb.client.FindIterable<org.bson.Document> initiateFind(com.mongodb.client.MongoCollection<org.bson.Document> collection, Function<com.mongodb.client.MongoCollection<org.bson.Document>, com.mongodb.client.FindIterable<org.bson.Document>> find) Apply query specific settings toMongoCollection
and initiate a find operation returning aFindIterable
via the givenfind
function.- Parameters:
collection
- must not be null.find
- must not be null.- Returns:
- never null.
- Throws:
IllegalArgumentException
- if one of the required arguments is null.- Since:
- 2.2
-
getReadPreference
- Specified by:
getReadPreference
in interfaceReadPreferenceAware
- Returns:
- the
ReadPreference
to apply or null if none defined. - Since:
- 2.2
-