Hello guys, Am using ktor and mongoDB as my backen...
# server
i
Hello guys, Am using ktor and mongoDB as my backend for an android project. When inserting a document, the acknowledgement returns true, but when i get InsertedId, it returns null despite being inserted in the database
😶 4
🚔 1
r
Have you tried looking at the bug tracker of your mongo database client to see if that's a known issue?
i
There seems to be a way with how one structures the id on the POJO. I havent found how when using ktor.
This is my data class
📃 1
📝 1
Finaly found a work around on the issue. Regarding retrieving the id from the inserted document after acknowledgement, you have to make an insertion then after the acknowledgement, retrieve the inserted id through another query using anotger unique field. Normally the inserted document returns a Boolean of acknowledgement and the insertedId. But you will notice that the insertedId is null even when acknowledgement is true.