Skip to content

fix mongo: avoid deprecated bson_append_array_begin#1283

Closed
crystarm wants to merge 1 commit into
userver-framework:developfrom
crystarm:fix/mongo-bson-array-begin-deprecation
Closed

fix mongo: avoid deprecated bson_append_array_begin#1283
crystarm wants to merge 1 commit into
userver-framework:developfrom
crystarm:fix/mongo-bson-array-begin-deprecation

Conversation

@crystarm

@crystarm crystarm commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Related to #1225.

Summary

Fixes usage of bson_append_array_begin, which is deprecated in libbson / mongo-c-driver 2.3.0.

For libbson 2.3.0+, use bson_append_array_unsafe_begin instead. Older supported libbson versions keep using bson_append_array_begin, because bson_append_array_unsafe_begin is not available there.

The replacement preserves the existing bson_t* subarray-building flow and remains compatible with the current manual array key generation via ArrayIndexer.

@crystarm crystarm marked this pull request as draft June 30, 2026 14:01
@crystarm

crystarm commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Testing was done with locally built mongo-c-driver / libbson 2.3.0.

Userver was configured with -DCMAKE_PREFIX_PATH=/home/georgij/.local/mongo-c-driver-2.3.0.
CMake confirmed: Mongoc: using config version: (bson: 2.3.0, mongoc: 2.3.0).

Ran tests: ctest --test-dir build_debug_mongo_2_3/mongo -V -R userver-mongo-unittest.

@crystarm crystarm marked this pull request as ready for review June 30, 2026 14:33
@apolukhin apolukhin changed the title fix(mongo): avoid deprecated bson_append_array_begin fix mongo: avoid deprecated bson_append_array_begin Jun 30, 2026
@apolukhin

Copy link
Copy Markdown
Member

LGTM

@robot-magpie

robot-magpie Bot commented Jun 30, 2026

Copy link
Copy Markdown

Many thanks for the PR! @apolukhin is now importing your pull request into our internal upstream repository.

@robot-magpie

robot-magpie Bot commented Jul 1, 2026

Copy link
Copy Markdown

✅ This pull request is being closed because it has been successfully merged into our internal monorepository.
Your changes will be pushed to this repository soon. Thank you for your contribution!

@robot-magpie robot-magpie Bot closed this Jul 1, 2026
robot-piglet pushed a commit that referenced this pull request Jul 1, 2026
Fixes #1225

## Summary

Fixes usage of `bson_append_array_begin`, which is deprecated in libbson / mongo-c-driver `2.3.0`.

For libbson `2.3.0+`, use `bson_append_array_unsafe_begin` instead. Older supported libbson versions keep using `bson_append_array_begin`, because `bson_append_array_unsafe_begin` is not available there.

The replacement preserves the existing `bson_t*` subarray-building flow and remains compatible with the current manual array key generation via `ArrayIndexer`.

---

Pull Request resolved: #1283
commit_hash:5886162296aa75b2ce13961d2f53df9d49b1cde6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants