Class Projection


  • public class Projection
    extends Object
    Defines a query projection
    • Method Detail

      • exclude

        public FindOptions exclude​(String... fields)
        Adds a field to the projection clause. The _id field is always included unless explicitly suppressed.
        Parameters:
        fields - the fields to exclude
        Returns:
        this
        See Also:
        Project Fields to Return from Query
      • include

        public FindOptions include​(String... fields)
        Adds a field to the projection clause. The _id field is always included unless explicitly suppressed.
        Parameters:
        fields - the fields to include
        Returns:
        this
        See Also:
        Project Fields to Return from Query
      • knownFields

        public FindOptions knownFields()
        Configure the project to only return known, mapped fields
        Returns:
        this
      • map

        @Nullable
        public org.bson.Document map​(Mapper mapper,
                                     Class<?> type)
        Converts this to Document form
        Parameters:
        mapper - the Mapper to use
        type - the entity type
        Returns:
        this