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() @IntrinsicCandidate()
  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

    Projections.computedSearchMeta

    Aggregates#project(Bson)

  7. def computedSearchMeta(fieldName: String): Bson

    Creates a projection of a field whose value is equal to the $$SEARCH_META variable, for use with Aggregates.search(SearchOperator, SearchOptions) / Aggregates.search(SearchCollector, SearchOptions).

    Creates a projection of a field whose value is equal to the $$SEARCH_META variable, for use with Aggregates.search(SearchOperator, SearchOptions) / Aggregates.search(SearchCollector, SearchOptions). Calling this method is equivalent to calling Projections.computed with "$$SEARCH_META" as the second argument.

    fieldName

    the field name

    returns

    the projection

    See also

    org.mongodb.scala.model.search.SearchCount

    org.mongodb.scala.model.search.SearchCollector

  8. 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

  9. 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)

  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. 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

  13. 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

  14. 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

  15. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  17. 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

  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. 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

    Projections.metaTextScore

    Projections.metaSearchScore

    Projections.metaSearchHighlights

  20. def metaSearchHighlights(fieldName: String): Bson

    Creates a projection to the given field name of the searchHighlights, for use with Aggregates.search(SearchOperator, SearchOptions) / Aggregates.search(SearchCollector, SearchOptions).

    Creates a projection to the given field name of the searchHighlights, for use with Aggregates.search(SearchOperator, SearchOptions) / Aggregates.search(SearchCollector, SearchOptions). Calling this method is equivalent to calling Projections.meta with "searchHighlights" as the second argument.

    fieldName

    the field name

    returns

    the projection

    See also

    org.mongodb.scala.model.search.SearchHighlight

    Highlighting

  21. def metaSearchScore(fieldName: String): Bson

    Creates a projection to the given field name of the searchScore, for use with Aggregates.search(SearchOperator, SearchOptions) / Aggregates.search(SearchCollector, SearchOptions).

    Creates a projection to the given field name of the searchScore, for use with Aggregates.search(SearchOperator, SearchOptions) / Aggregates.search(SearchCollector, SearchOptions). Calling this method is equivalent to calling Projections.meta with "searchScore" as the second argument.

    fieldName

    the field name

    returns

    the projection

    See also

    Scoring

  22. 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. Calling this method is equivalent to calling Projections.meta with "textScore" as the second argument.

    fieldName

    the field name

    returns

    the projection

    See also

    Filters.text(String, TextSearchOptions)

    textScore

  23. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  24. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  25. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  26. 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

  27. 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

  28. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  29. def toString(): String
    Definition Classes
    AnyRef → Any
  30. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  31. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  32. 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