-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
(copied to CRM)
-
None
-
C Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Proposal
Deprecate bson_append_array_begin and BSON_APPEND_ARRAY_BEGIN
Background & Motivation
Some libbson array building APIs make it easy to construct an array with invalid keys:
bson_t doc = BSON_INITIALIZER, subarray; BSON_APPEND_ARRAY_BEGIN(&doc, "array", &subarray); BSON_APPEND_UTF8(&subarray, "1", "foo"); // Oops! Should be "0". bson_append_array_end (&doc, &subarray);
BSON arrays are expected to have sequential keys "0", "1", "2", ...
bson_array_builder_t provides a safer alternative to creating BSON arrays in libbson:
bson_t doc = BSON_INITIALIZER; bson_array_builder_t *builder; BSON_APPEND_ARRAY_BUILDER_BEGIN(&doc, "array", &builder); bson_array_builder_append_utf8(builder, "foo", -1); bson_append_array_builder_end(&doc, builder);
- has to be done before
-
CDRIVER-6184 Remove deprecated array helpers
-
- Backlog
-
- related to
-
CDRIVER-6185 Extend bson_array_builder_t API
-
- Backlog
-