Packages

object Projections

A factory for projections. A convenient way to use this class is to statically import all of its methods, which allows usage like:

collection.find().projection(fields(include("x", "y"), excludeId()))

Since

1.0

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Projections
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  6. def computed[TExpression](fieldName: String, expression: TExpression): Bson

    Creates a projection of a field whose value is computed from the given expression.

    Creates a projection of a field whose value is computed from the given expression. Projection with an expression is only supported using the $project aggregation pipeline stage.

    TExpression

    the expression type

    fieldName

    the field name

    expression

    the expression

    returns

    the projection

    See also

    Aggregates#project(Bson)

  7. def elemMatch(fieldName: String, filter: Bson): Bson

    Creates a projection that includes for the given field only the first element of the array value of that field that matches the given query filter.

    Creates a projection that includes for the given field only the first element of the array value of that field that matches the given query filter.

    fieldName

    the field name

    filter

    the filter to apply

    returns

    the projection

    See also

    elemMatch

  8. def elemMatch(fieldName: String): Bson

    Creates a projection that includes for the given field only the first element of an array that matches the query filter.

    Creates a projection that includes for the given field only the first element of an array that matches the query filter. This is referred to as the positional $ operator.

    fieldName

    the field name whose value is the array

    returns

    the projection

    See also

    Project the first matching element ($ operator)

  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. def exclude(fieldNames: String*): Bson

    Creates a projection that excludes all of the given fields.

    Creates a projection that excludes all of the given fields.

    fieldNames

    the field names

    returns

    the projection

  12. def excludeId(): Bson

    Creates a projection that excludes the _id field.

    Creates a projection that excludes the _id field. This suppresses the automatic inclusion of _id that is the default, even when other fields are explicitly included.

    returns

    the projection

  13. def fields(projections: Bson*): Bson

    Creates a projection that combines the list of projections into a single one.

    Creates a projection that combines the list of projections into a single one. If there are duplicate keys, the last one takes precedence.

    projections

    the list of projections to combine

    returns

    the combined projection

  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. def include(fieldNames: String*): Bson

    Creates a projection that includes all of the given fields.

    Creates a projection that includes all of the given fields.

    fieldNames

    the field names

    returns

    the projection

  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. def meta(fieldName: String, metaFieldName: String): Bson

    Creates a $meta projection to the given field name for the given meta field name.

    Creates a $meta projection to the given field name for the given meta field name.

    fieldName

    the field name

    metaFieldName

    the meta field name

    returns

    the projection

    Since

    4.1

    See also

    meta

  19. def metaTextScore(fieldName: String): Bson

    Creates a projection to the given field name of the textScore, for use with text queries.

    Creates a projection to the given field name of the textScore, for use with text queries.

    fieldName

    the field name

    returns

    the projection

    See also

    textScore

  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  22. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  23. def slice(fieldName: String, skip: Int, limit: Int): Bson

    Creates a projection to the given field name of a slice of the array value of that field.

    Creates a projection to the given field name of a slice of the array value of that field.

    fieldName

    the field name

    skip

    the number of elements to skip before applying the limit

    limit

    the number of elements to project

    returns

    the projection

    See also

    Slice

  24. def slice(fieldName: String, limit: Int): Bson

    Creates a projection to the given field name of a slice of the array value of that field.

    Creates a projection to the given field name of a slice of the array value of that field.

    fieldName

    the field name

    limit

    the number of elements to project.

    returns

    the projection

    See also

    Slice

  25. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  26. def toString(): String
    Definition Classes
    AnyRef → Any
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  29. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped