Thanks for the advice, Andrey. I did it with a sli...
# exposed
z
Thanks for the advice, Andrey. I did it with a slight modification (because insertAndGetId was an unresolved reference)
Copy code
val userId = Users.select {
                Users.deviceId eq requestDeviceId
            }.map { it[Users.id] }.singleOrNull() ?: Users.insert {
                it[deviceId] = requestDeviceId
            } get Users.id
t
Sure, any PRs to documentation are very welcome. InsertAndGetId is available in newer versions of Exposed.