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
- Alphabetic
- By Inheritance
- Projections
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
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)
-
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
-
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
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
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
-
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
-
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
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
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
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
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
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
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
-
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
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
This is the documentation for the MongoDB Scala driver.
Driver structure
The mongodb scala driver.
To get started you need a MongoClient instance, either from a connection string or via a org.mongodb.scala.MongoClientSettings.
Notable packages include: