Description
_has_out_key() currently returns true if any pipeline stage is $out. Since $out can only be used in the last position (server will error otherwise), we can optimize this function to only inspect the final stage.
There should be no negative effects to this change. If $out is used in the middle of a pipeline, libmongoc would then decide not to inherit a write concern and the server would ultimately return an error for a malformed pipeline.