Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-1916

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

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • 1.6.0
    • Affects Version/s: None
    • Component/s: libbson
    • 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:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            rassi J Rassi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: