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

Add a function to retrieve the key length on a bson_iter_t

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • None
    • None

    Description

      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.

      Attachments

        Activity

          People

            kevin.albertson@mongodb.com Kevin Albertson
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: