Add a function to retrieve the key length on a bson_iter_t

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Duplicate
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      bson_iter_t knows the key length of the current element.

      It computes the key length in _bson_iter_next_internal

         /* iterate from start to end of NULL-terminated key string */
         for (o = iter->off + 1; o < len; o++) {
            if (!data[o]) {
               iter->d1 = ++o;
               goto fill_data_fields;
            }
         }
      

      And it does not change d1. So iter.d1 - iter.key (plus one?) should be the length of the key.

            Assignee:
            Kevin Albertson
            Reporter:
            Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: