Ryunos
10/12/2022, 2:18 PMfun <E : Any> SortProperty.toSortBson(kClass: KClass<E>): Bson {
val kProperty = kClass.memberProperties.find { it.name == this.property }
?: throw InvalidSortPropertyException(this.property, kClass.simpleName)
return if (this.direction == SortDirection.ASC) {
ascending(kProperty)
} else {
descending(kProperty)
}
}