Skip to content

Commit

Permalink
fix: Issues with new mongokt version
Browse files Browse the repository at this point in the history
  • Loading branch information
lsafer-meemer committed Dec 12, 2024
1 parent 200aa9f commit 88eca55
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions module-ped-bson/src/commonMain/kotlin/BsonCodecs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -300,17 +300,17 @@ typealias BsonIdCodec = BsonIDCodec
*
* @since 2.0.0
*/
object BsonIDCodec : BsonCodec<ID<*>> {
object BsonIDCodec : BsonCodec<ID<Any?>> {
override fun encode(value: Any?) =
tryInlineCodec(value) { it: ID<*> ->
tryInlineCodec(value) { it: ID<Any?> ->
success(it.bson)
}

override fun decode(value: Any?) =
tryInlineCodec(value) { it: BsonElement ->
when (it) {
is BsonObjectId -> success(ID<Any>(it.value))
is BsonString -> success(ID(it.value))
is BsonObjectId -> success(ID<Any?>(it.value))
is BsonString -> success(ID<Any?>(it.value))
else -> failure(
CodecException(
"Cannot decode ${it::class}; expected either " +
Expand Down

0 comments on commit 88eca55

Please sign in to comment.