https://kotlinlang.org logo
#ktor
Title
# ktor
i

IsaacMart

06/16/2022, 2:17 PM
Hello team, am new to mongodb and am using it for my ktor project. How can i return the inserted document back to client after insertion. I need the doc to store it in room
a

Aleksei Tirman [JB]

06/16/2022, 3:35 PM
I suggest asking this question in #kmongo channel.
i

IsaacMart

06/16/2022, 3:41 PM
Thanks @Aleksei Tirman [JB] let me check it over there
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.
10 Views