MongoDB request DSL • opensavvy.ktmongo.dsl.options • SortOptionDsl
SortOptionDsl¶
interface SortOptionDsl<Document : Any> : CompoundBsonNode, FieldDsl
DSL to describe a sort order.
This DSL declares the methods ascending
and descending
which describe in which order elements are sorted.
For example,
will sort users in alphabetical order of their name, and when users have the same name, will sort them in decreasing order of their age.
See WithSort.sort
.
Properties¶
context
¶
abstract val context:
The context used to generate this expression.
field
¶
Converts a Kotlin property into a Field
.
Functions¶
accept
¶
Adds a new node
as a child of this one.
acceptAll
¶
Adds any number of nodes
into this one.
ascending
¶
open fun ascending(field: KProperty1<Document, *>)
If two documents have a different value of field
, the one with lesser value will be returned first.
If two documents have a different value of field
, the one with lesser value will be returned first.
descending
¶
open fun descending(field: KProperty1<Document, *>)
If two documents have a different value of field
, the one with greater value will be returned first.
abstract fun descending(field: Field<Document, *>)
If two documents have a different value of field
, the one with greater value will be returned first.
div
¶
Refers to child
as a nested field of the current field.
freeze
¶
abstract override fun freeze()
Makes this expression immutable.
get
¶
Refers to a specific item in an array, by its index.
Refers to a specific item in a map, by its name.
simplify
¶
Returns a simplified (but equivalent) expression to the current expression.
toBson
¶
open fun toBson():
Writes the result of simplifying
to a new Bson.
toString
¶
JSON representation of this expression.
writeTo
¶
abstract fun writeTo(writer: )
Writes the result of simplifying
this expression into writer
.