FieldDsl
Operators to construct MongoDB field references from Kotlin code.
The algorithm used to convert from a Kotlin KProperty1 can be configured with PropertyNameStrategy.
Example
class User(
val name: String,
val age: Int,
val profile: Profile,
)
class Profile(
val id: ObjectId,
val friends: List<ObjectId>,
)
with(FieldDsl(users.context)) {
// 'name'
User::name
// 'age'
User::age
// 'profile.id'
User::profile / Profile::id
// 'profile.friends'
User::profile / Profile::friends
}Content copied to clipboard
In most situations, an instance of this interface should be provided in all operations that require it. For example, the find {} method provides an instance of FilterQuery, which implements this interface.
Inheritors
Properties
Functions
Link copied to clipboard
open operator fun <Root, Parent, Child> KProperty1<Root, Parent>.div(child: KProperty1<Parent & Any, Child>): Field<Root, Child>
open operator fun <Root, Type, Child> Field<Root, Type>.div(child: KProperty1<in Type & Any, Child>): Field<Root, Child>
open operator fun <Root, Type, Child> Field<Root, Type>.div(child: Field<Type, Child>): Field<Root, Child>
Refers to child as a nested field of the current field.
Link copied to clipboard
open operator fun <Root, Type> KProperty1<Root, Collection<Type>>.get(index: Int): Field<Root, Type>
Refers to a specific item in an array, by its index.
open operator fun <Root, Type> KProperty1<Root, Map<String, Type>>.get(index: String): Field<Root, Type>
Refers to a specific item in a map, by its name.
Link copied to clipboard