object Sorts
A factory for sort specifications. A convenient way to use this class is to statically import all of its methods, which allows usage like:
collection.find().sort(orderBy(ascending("x", "y"), descending("z")))
- Since
1.0
- Alphabetic
- By Inheritance
- Sorts
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- def ascending(fieldNames: String*): Bson
Create a sort specification for an ascending sort on the given fields.
Create a sort specification for an ascending sort on the given fields.
- fieldNames
the field names, which must contain at least one
- returns
the sort specification
- See also
- def descending(fieldNames: String*): Bson
Create a sort specification for an ascending sort on the given fields.
Create a sort specification for an ascending sort on the given fields.
- fieldNames
the field names, which must contain at least one
- returns
the sort specification
- See also
- def metaTextScore(fieldName: String): Bson
Create a sort specification for the text score meta projection on the given field.
Create a sort specification for the text score meta projection on the given field.
- fieldName
the field name
- returns
the sort specification
- See also
Filters.text(String, TextSearchOptions)
- def orderBy(sorts: Bson*): Bson
Combine multiple sort specifications.
Combine multiple sort specifications. If any field names are repeated, the last one takes precendence.
- sorts
the sort specifications
- returns
the combined sort specification
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: