min

abstract fun <T : Any> min(property: String, type: KClass<T>): RealmScalarNullableQuery<T>

Finds the minimum value of a property.

A reified version of this method is also available as an extension function, query.min<YourClass>(...). Import io.realm.query.min to access it.

Return

a RealmScalarQuery returning the minimum value for the given property represented as a T. If no objects exist or they all have null as the value for the given property, null will be returned by the query. Otherwise, the minimum value is returned. When determining the minimum value, objects with null values are ignored.

Parameters

property

the property on which to find the minimum value. Only Number and RealmInstant properties are supported.

type

the type of the resulting aggregated value, which may or may not coincide with the type of the property itself.

Throws

if the property is not a Number or a Char, or if type cannot be used to represent the property.