bson_iter_init_find() and bson_iter_init_find_case() should return false only when iterator is successfully exhausted and key not found

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Won't Fix
    • Priority: Major - P3
    • 1.6.0
    • Affects Version/s: None
    • Component/s: libbson
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      bson_iter_init_find() and bson_iter_init_find_case() are currently documented to return false in either of the following two circumstances:

      1. Iterator initialization fails.
      2. The iterator was successfully exhausted and the requested key was not found.

      Because of this ambiguity, it is not currently clear whether or not a consumer of this API should propagate an error up the call stack when it receives a false return value from one of these two functions.

      Instead, these API functions should BSON_ASSERT() that iterator initialization was successful, and their documentation should be updated to reflect that they will never return an error.

      See also my comment at CXX-1066 for further discussion.

              Assignee:
              A. Jesse Jiryu Davis
              Reporter:
              J Rassi (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: