Skip to content

Commit bf7554c

Browse files
authored
CXX-3302 Update bsoncxx validation examples with offsets (#1416)
* Update examples for CDRIVER-5710 and CDRIVER-6017 * Add missing import of ec2_assume_role * Bump minimum required C Driver version to 2.0.2
1 parent f88307a commit bf7554c

File tree

11 files changed

+27
-26
lines changed

11 files changed

+27
-26
lines changed

.evergreen/config_generator/components/funcs/install_c_driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# Only MONGOC_DOWNLOAD_VERSION needs to be updated when pinning to an unreleased commit.
1515
# If pinning to an unreleased commit, create a "Blocked" JIRA ticket with
1616
# a "depends on" link to the appropriate C Driver version release ticket.
17-
MONGOC_VERSION_MINIMUM = '2.0.0'
17+
MONGOC_VERSION_MINIMUM = '2.0.2'
1818

1919

2020
class InstallCDriver(Function):

.evergreen/config_generator/components/mongohouse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from config_generator.etc.utils import bash_exec
99

1010
from shrub.v3.evg_build_variant import BuildVariant
11-
from shrub.v3.evg_command import EvgCommandType
11+
from shrub.v3.evg_command import EvgCommandType, ec2_assume_role
1212
from shrub.v3.evg_task import EvgTask, EvgTaskRef
1313

1414

.evergreen/generated_configs/functions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ functions:
443443
type: setup
444444
params:
445445
updates:
446-
- { key: mongoc_version_minimum, value: 2.0.0 }
446+
- { key: mongoc_version_minimum, value: 2.0.2 }
447447
- command: subprocess.exec
448448
type: setup
449449
params:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Changes prior to 3.9.0 are documented as [release notes on GitHub](https://githu
1616
### Changed
1717

1818
- CMake 3.16.0 or newer is required when `ENABLE_TESTS=ON` for compatibility with the updated Catch2 library version (3.7.0 -> 3.8.1).
19+
- Bump the minimum required C Driver version to [2.0.2](https://github.com/mongodb/mongo-c-driver/releases/tag/2.0.2).
1920

2021
## 4.1.0
2122

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ else()
4545
endif()
4646

4747
# Also update etc/purls.txt.
48-
set(BSON_REQUIRED_VERSION 2.0.0)
49-
set(MONGOC_REQUIRED_VERSION 2.0.0)
50-
set(MONGOC_DOWNLOAD_VERSION 2.0.0)
48+
set(BSON_REQUIRED_VERSION 2.0.2)
49+
set(MONGOC_REQUIRED_VERSION 2.0.2)
50+
set(MONGOC_DOWNLOAD_VERSION 2.0.2)
5151

5252
# All of our target compilers support the deprecated
5353
# attribute. Normally, we would just let the GenerateExportHeader

etc/augmented.sbom.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"components": [
33
{
4-
"bom-ref": "pkg:github/mongodb/[email protected].0",
4+
"bom-ref": "pkg:github/mongodb/[email protected].2",
55
"copyright": "Copyright 2009-present MongoDB, Inc.",
66
"externalReferences": [
77
{
88
"type": "distribution",
9-
"url": "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/v2.0.0.tar.gz"
9+
"url": "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/v2.0.2.tar.gz"
1010
},
1111
{
1212
"type": "website",
13-
"url": "https://github.com/mongodb/mongo-c-driver/tree/v2.0.0"
13+
"url": "https://github.com/mongodb/mongo-c-driver/tree/v2.0.2"
1414
}
1515
],
1616
"group": "mongodb",
@@ -22,18 +22,18 @@
2222
}
2323
],
2424
"name": "mongo-c-driver",
25-
"purl": "pkg:github/mongodb/[email protected].0",
25+
"purl": "pkg:github/mongodb/[email protected].2",
2626
"type": "library",
27-
"version": "v2.0.0"
27+
"version": "v2.0.2"
2828
}
2929
],
3030
"dependencies": [
3131
{
32-
"ref": "pkg:github/mongodb/[email protected].0"
32+
"ref": "pkg:github/mongodb/[email protected].2"
3333
}
3434
],
3535
"metadata": {
36-
"timestamp": "2025-04-02T19:47:45.682404+00:00",
36+
"timestamp": "2025-06-12T17:36:20.890153+00:00",
3737
"tools": [
3838
{
3939
"externalReferences": [

etc/cyclonedx.sbom.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"components": [
33
{
4-
"bom-ref": "pkg:github/mongodb/[email protected].0",
4+
"bom-ref": "pkg:github/mongodb/[email protected].2",
55
"copyright": "Copyright 2009-present MongoDB, Inc.",
66
"externalReferences": [
77
{
88
"type": "distribution",
9-
"url": "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/v2.0.0.tar.gz"
9+
"url": "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/v2.0.2.tar.gz"
1010
},
1111
{
1212
"type": "website",
13-
"url": "https://github.com/mongodb/mongo-c-driver/tree/v2.0.0"
13+
"url": "https://github.com/mongodb/mongo-c-driver/tree/v2.0.2"
1414
}
1515
],
1616
"group": "mongodb",
@@ -22,18 +22,18 @@
2222
}
2323
],
2424
"name": "mongo-c-driver",
25-
"purl": "pkg:github/mongodb/[email protected].0",
25+
"purl": "pkg:github/mongodb/[email protected].2",
2626
"type": "library",
27-
"version": "v2.0.0"
27+
"version": "v2.0.2"
2828
}
2929
],
3030
"dependencies": [
3131
{
32-
"ref": "pkg:github/mongodb/[email protected].0"
32+
"ref": "pkg:github/mongodb/[email protected].2"
3333
}
3434
],
3535
"metadata": {
36-
"timestamp": "2025-05-01T20:23:28.401764+00:00",
36+
"timestamp": "2025-06-12T17:36:20.890153+00:00",
3737
"tools": [
3838
{
3939
"externalReferences": [

etc/make_release.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
show_default=True,
9292
help='The remote reference which points to the mongodb/mongo-cxx-driver repo')
9393
@click.option('--c-driver-build-ref',
94-
default='2.0.0',
94+
default='2.0.2',
9595
show_default=True,
9696
help='When building the C driver, build at this Git reference')
9797
@click.option('--with-c-driver',

etc/purls.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# re-generate the SBOM JSON file!
77

88
# bson and mongoc may be obtained via cmake/FetchMongoC.cmake.
9-
pkg:github/mongodb/[email protected].0
9+
pkg:github/mongodb/[email protected].2

examples/api/bsoncxx/examples/validation/basic_usage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ void example() {
6161

6262
EXPECT(bsoncxx::validate(data, length) == bsoncxx::validate(data, length, options, &offset));
6363

64-
// Not set when valid.
65-
EXPECT(offset == 123u);
64+
// Set to 0 when valid.
65+
EXPECT(offset == 0u);
6666
}
6767
}
6868
// [Example]

examples/api/bsoncxx/examples/validation/validator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ void example(std::uint8_t const* bytes, std::size_t length) {
7777

7878
EXPECT(!bsoncxx::validate(bytes, length, options, &offset));
7979

80-
// Offset of `"$numberInt": "123"` relative to start of the sub-document. (CDRIVER-5710)
81-
EXPECT(offset == 4u);
80+
// Offset of `"$numberInt": "123"` relative to start of the document.
81+
EXPECT(offset == 31u);
8282
}
8383
}
8484
// [Example]

0 commit comments

Comments
 (0)