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

how to generate bson with unfinished data and append some more element here?

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 0.8.1
    • None
    • None
    • win7 32

    Description

      I code it like this below, but no one can work.
      ========================================================
      bson b2[1];

      char * buffer;
      int size;

      size = bson_size(b);
      buffer = (char *)malloc(size);
      memcpy(buffer, bson_data(b), size);

      //bson_init_unfinished_data(b2, buffer, size, 0); // no effect
      //bson_init_unfinished_data(b2, buffer, size, 1); // with crash
      //bson_init_finished_data_with_copy(b2, bson_data(b)); // no effect
      bson_append_int(b2, "age", 18);

      bson_finish( b2 );
      bson_print( b2 );

      ======================================================

      best regard and thanks.

      Attachments

        Activity

          People

            gjmurakami Gary Murakami
            smallrui smallrui
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: