Class FindOptions


  • public class FindOptions
    extends Object
    The options to apply to a find operation (also commonly referred to as a query).
    • Constructor Detail

      • FindOptions

        public FindOptions()
        Construct a new instance.
    • Method Detail

      • getLimit

        public int getLimit()
        Gets the limit to apply. The default is null.
        Returns:
        the limit
      • limit

        public FindOptions limit​(int limit)
        Sets the limit to apply.
        Parameters:
        limit - the limit, which may be null
        Returns:
        this
      • getProjection

        @Nullable
        public Bson getProjection()
        Gets a document describing the fields to return for all matching documents.
        Returns:
        the project document, which may be null
      • projection

        public FindOptions projection​(@Nullable
                                      Bson projection)
        Sets a document describing the fields to return for all matching documents.
        Parameters:
        projection - the project document, which may be null.
        Returns:
        this
      • getSort

        @Nullable
        public Bson getSort()
        Gets the sort criteria to apply to the query. The default is null, which means that the documents will be returned in an undefined order.
        Returns:
        a document describing the sort criteria
      • sort

        public FindOptions sort​(@Nullable
                                Bson sort)
        Sets the sort criteria to apply to the query.
        Parameters:
        sort - the sort criteria, which may be null.
        Returns:
        this