Interface CursorPreparer

All Superinterfaces:
ReadPreferenceAware

public interface CursorPreparer extends ReadPreferenceAware
Simple callback interface to allow customization of a FindIterable.
Author:
Oliver Gierke, Christoph Strobl
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final CursorPreparer
    Default CursorPreparer just passing on the given FindIterable.
  • Method Summary

    Modifier and Type
    Method
    Description
    default 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 to MongoCollection and initate a find operation returning a FindIterable via the given find 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

  • 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 to MongoCollection and initate a find operation returning a FindIterable via the given find 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

      @Nullable default com.mongodb.ReadPreference getReadPreference()
      Specified by:
      getReadPreference in interface ReadPreferenceAware
      Returns:
      the ReadPreference to apply or null if none defined.
      Since:
      2.2