Litote / kmongo

[deprecated] KMongo - a Kotlin toolkit for Mongo
https://litote.org/kmongo/
Apache License 2.0
781 stars 74 forks source link

Update unsigned integers #356

Closed CLOVIS-AI closed 2 years ago

CLOVIS-AI commented 2 years ago
@Serializable
class Foo(
    @SerialName("_id") val id: Id<Foo>,
    val counter: ULong,
) 

Trying to increase the counter:

foo.updateOne(Foo::id eq id, inc(Foo::counter, 1))

fails with:

Type mismatch.
  Required: Number?
  Found: ULong

It seems like ULong & co do not inherit from Number, so it is not possible to increment them easily using the API.

zigzago commented 2 years ago

Thank you for reporting. I fix it.