DBClientCursor will implement the client side of the exhaust cursor OP_MSG protocol when commands are being used and QueryOption_Exhaust is requested.
- When more() is called after the initial find command, it will set the wire protocol bit exhaustAllowed on the getMore command it sends. DBClientCursor will not set this bit on initial find commands. Note that older implementations which do not support OP_MSG exhaust will ignore this bit, as required by the wire protocol spec.
- When more() is called after there was a response to the getMore command that had the wire protocol moreToCome bit set, it will receive the next batch and make it available to the caller.
- If the response does not have the moreToCome bit set and it indicates an error or the cursor is exhausted (cursor id of 0), more() will return false.
- If the response does not have the moreToCome bit set, and also does not indicate the cursor is exhausted or contain an error, DBClientCursor will send another getMore command. This handles the upgrade case when connecting to a 4.0 implementation which does not support OP_MSG exhaust.
As part of this work, we will remove OP_QUERY exhaust support from DBClientConnection. This is currently used only by the database cloner, so the only effect of this will be to cause a performance regression when cloning between 4.0 and 4.2, and the commands which use the database cloner are deprecated.