3 ms·
Presumably this has to be done in the driver directly after the insert call - on the same connection, to ensure that you actually get the last error, and not so
by grey-area 14y ago
Presumably this has to be done in the driver directly after the insert call - on the same connection, to ensure that you actually get the last error, and not someone else's error, if you have several instances writing to the db?
- prodigal_erik 14y agoMongo's wire protocol actually has request IDs, but it appears db.$cmd.findOne({getlasterror:1}) doesn't use that. Instead you have to send it over the same connection as the operation in question, and if you had to reconnect you're just fucked and will never know what you may or may not have committed.