diff --git a/dsl-template/src/commonMain/kotlin/path/Field.kt b/dsl-template/src/commonMain/kotlin/path/Field.kt index 1b9bd6d0..d5ddf0c6 100644 --- a/dsl-template/src/commonMain/kotlin/path/Field.kt +++ b/dsl-template/src/commonMain/kotlin/path/Field.kt @@ -87,7 +87,7 @@ interface Field { /** * Overwrites the represented type of this field. * - * This method can be useful to bypass type checks. + * This method can be useful to bypass type checks, it tells KtMongo to treat the field as if it were of some other type. */ @Suppress("UNCHECKED_CAST") fun unsafeCast(): Field = @@ -361,6 +361,14 @@ interface FieldDsl { infix fun KProperty1.unsafe(child: KProperty1<*, Child>): Field = this.field.unsafe(child) + /** + * Overwrites the represented type of this field. + * + * This method can be useful to bypass type checks, it tells KtMongo to treat the field as if it were of some other type. + */ + fun KProperty1.unsafeCast(): Field = + this.field.unsafeCast() + /** * Refers to [child] as a nested field of the current field. * diff --git a/dsl/src/commonMain/kotlin/path/Field.kt b/dsl/src/commonMain/kotlin/path/Field.kt index ece9a7a2..60e9591e 100644 --- a/dsl/src/commonMain/kotlin/path/Field.kt +++ b/dsl/src/commonMain/kotlin/path/Field.kt @@ -90,7 +90,7 @@ interface Field { /** * Overwrites the represented type of this field. * - * This method can be useful to bypass type checks. + * This method can be useful to bypass type checks, it tells KtMongo to treat the field as if it were of some other type. */ @Suppress("UNCHECKED_CAST") fun unsafeCast(): Field = @@ -364,6 +364,14 @@ interface FieldDsl { infix fun KProperty1.unsafe(child: KProperty1<*, Child>): Field = this.field.unsafe(child) + /** + * Overwrites the represented type of this field. + * + * This method can be useful to bypass type checks, it tells KtMongo to treat the field as if it were of some other type. + */ + fun KProperty1.unsafeCast(): Field = + this.field.unsafeCast() + /** * Refers to [child] as a nested field of the current field. *