Refactor _has_out_key to only inspect last pipeline stage

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Minor - P4
    • 1.16.0
    • Affects Version/s: None
    • Component/s: libmongoc
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      _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.

            Assignee:
            Isabel Atkinson
            Reporter:
            Jeremy Mikola (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: