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

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 0.8.1
    • Component/s: None
    • None
    • Environment:
      win7 32
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            Gary Murakami (Inactive)
            Reporter:
            smallrui
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: