lua-mongo find after update returns outdated value

63 views
Skip to first unread message

Antonio Scuri

unread,
Nov 23, 2025, 12:06:07 PM (4 days ago) Nov 23
to lu...@googlegroups.com
Hi All,

If I retrieve data from the database after an update or even replaceOne, it returns the old value. 

These are done in separate places, so I cannot use findAndModify. I need something to check the update status, or something to control the several updates.

I guess this could be done using client:command but I have no idea how.

Any ideas?

Thanks is Advance,
Antonio Scuri

Sainan

unread,
Nov 23, 2025, 12:43:43 PM (4 days ago) Nov 23
to lu...@googlegroups.com
Are you sure you're waiting for the update operation to finish before starting the find operation? Otherwise you might run into a race condition.

-- Sainan

Antonio Scuri

unread,
Nov 24, 2025, 6:12:55 PM (3 days ago) Nov 24
to lu...@googlegroups.com
That's exactly the problem, I couldn't find a way to wait for the update to complete. There is no method to do that.

Em dom., 23 de nov. de 2025 às 14:43, 'Sainan' via lua-l <lu...@googlegroups.com> escreveu:
Are you sure you're waiting for the update operation to finish before starting the find operation? Otherwise you might run into a race condition.

-- Sainan

--
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lua-l+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/lua-l/Ir2lUa-mtFDXi_CwONBC9oVpKR2bXZiVPwORtY4dvlHxG1cbgNdARA1dbhmYigbOKAo6pB7K1eIniInZceHDBLm0owAqnn01QNBzTocE48E%3D%40calamity.inc.
Reply all
Reply to author
Forward
0 new messages