is callback to a write operation guaranteed to be executed with wtimeout option specified?

13 views
Skip to first unread message

Qingping Wang

unread,
Apr 28, 2013, 12:37:31 AM4/28/13
to node-mong...@googlegroups.com


In order to figure out if the callback to the insert command gets called with w:1 option,
I digged a bit into the code. It seems every time this client insert a doc into mongodb,
it registers an event which is identified by the document's primary id, and when the
callaback to connections.write() is executed, getlasterror command runs; or there is
some magic under the hood... I am wondering how getlasterror works in this client.
the official manual states specifying wtimeout option can preventing getlasterror
block forever. maybe i missed something or there is some tricky magic here, but i
did not see how wtimeout is working along with getlasterror... many thanks for
clarification.

I think I should ask this question in another way: if a wtimeout was specified for
a insert command, what would happen if getlasterror gets nothing after wtimeout 
milliseconds. Would the callback be executed?
Reply all
Reply to author
Forward
0 new messages