Projection

mongo4cats.operations.Projection
See theProjection companion object
trait Projection

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def combinedWith(anotherProjection: Projection): Projection

Merges 2 sequences of projection operations together. If there are duplicate keys, the last one takes precedence.

Merges 2 sequences of projection operations together. If there are duplicate keys, the last one takes precedence.

Value parameters

anotherProjection

the projection to be merged with

Attributes

Returns

the projection

def computed[T](fieldName: String, expression: T): Projection

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.

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.

Value parameters

expression

the expression

fieldName

the field name

Attributes

Returns

the projection

def elemMatch(fieldName: String): Projection

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.

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.

Value parameters

fieldName

the field name whose value is the array

Attributes

Returns

the projection

def elemMatch(fieldName: String, filter: Filter): Projection

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.

Value parameters

fieldName

the field name

filter

the filter to apply

Attributes

Returns

the projection

def exclude(fieldName: String): Projection

Creates a projection that excludes all of the given fields.

Creates a projection that excludes all of the given fields.

Value parameters

fieldName

the field name

Attributes

Returns

the projection

def exclude(fieldNames: Seq[String]): Projection

Creates a projection that excludes all of the given fields.

Creates a projection that excludes all of the given fields.

Value parameters

fieldNames

the field names

Attributes

Returns

the projection

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.

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.

Attributes

Returns

the projection

def include(fieldName: String): Projection

Creates a projection that includes all of the given fields.

Creates a projection that includes all of the given fields.

Value parameters

fieldName

the field name

Attributes

Returns

the projection

def include(fieldNames: Seq[String]): Projection

Creates a projection that includes all of the given fields.

Creates a projection that includes all of the given fields.

Value parameters

fieldNames

the field names

Attributes

Returns

the projection

def meta(fieldName: String, metaFieldName: String): Projection

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.

Value parameters

fieldName

the field name

metaFieldName

the meta field name

Attributes

Returns

the projection

Since

4.1

def metaTextScore(fieldName: String): Projection

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.

Value parameters

fieldName

the field name

Attributes

Returns

the projection

def slice(fieldName: String, limit: Int): Projection

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.

Value parameters

fieldName

the field name

limit

the number of elements to project.

Attributes

Returns

the projection

def slice(fieldName: String, skip: Int, limit: Int): Projection

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.

Value parameters

fieldName

the field name

limit

the number of elements to project

skip

the number of elements to skip before applying the limit

Attributes

Returns

the projection