Skip to content

MongoDB: compatibility with >=mongo-cpp-driver-4 #12837

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 1, 2025

Conversation

parona-source
Copy link
Contributor

What does this PR do?

Fix api incompatibilities with >=mongo-cpp-driver-4.

https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/upgrade/#api-breaking-changes-in-v4.0

k_string is available as far back as 3.7, but I think its simpler to just check if the version is higher than 4.

What are related issues/pull requests?

Tasklist

  • AI (Copilot or something similar) supported my development of this PR
  • Make sure code is correctly formatted (cf pre-commit configuration)
  • Add test case(s)
  • Add documentation
  • Updated Python API documentation (swig/include/python/docs/)
  • Review
  • Adjust for comments
  • All CI builds and checks have passed
  • ADD YOUR TASKS HERE

Environment

Provide environment details, if relevant:

  • OS: Gentoo Linux amd64
  • Compiler: gcc (Gentoo 15.1.1_p20250705-r1 p2) 15.1.1 20250705

https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/upgrade/#api-breaking-changes-in-v4.0

k_string was available in 3.7, but its simpler to just do
BSONCXX_VERSION_MAJOR >= 4.

Signed-off-by: Alfred Wingate <[email protected]>
@rouault
Copy link
Member

rouault commented Aug 1, 2025

@parona-source Would you mind bumping MONGO_C_DRIVER_VERSION and MONGOCXX_VERSION in .github/workflows/ubuntu_24.04/Dockerfile.ci so that continuous integration can test this ?

@rouault rouault added the backport release/3.11 Backport to release/3.11 branch label Aug 1, 2025
@rouault rouault merged commit 200bbc8 into OSGeo:master Aug 1, 2025
38 checks passed
@rouault
Copy link
Member

rouault commented Aug 1, 2025

The backport to release/3.11 failed:

The process '/usr/bin/git' failed with exit code 1
stderr
To https://github.com/OSGeo/gdal.git
 ! [remote rejected]       backport-12837-to-release/3.11 -> backport-12837-to-release/3.11 (refusing to allow a Personal Access Token to create or update workflow `.github/workflows/ubuntu_24.04/Dockerfile.ci` without `workflow` scope)
error: failed to push some refs to 'https://github.com/OSGeo/gdal.git'

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release/3.11 release/3.11
# Navigate to the new working tree
cd .worktrees/backport-release/3.11
# Create a new branch
git switch --create backport-12837-to-release/3.11
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick 001e2abd31cbd3489891de7c3b403cecac3c8c0d,b3b77bdc132590a535d3438e8a136da100d7cc77
# Push it to GitHub
git push --set-upstream origin backport-12837-to-release/3.11
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release/3.11

Then, create a pull request where the base branch is release/3.11 and the compare/head branch is backport-12837-to-release/3.11.

@rouault rouault added this to the 3.11.4 milestone Aug 1, 2025
@rouault
Copy link
Member

rouault commented Aug 1, 2025

manually cherry-picked to 3.11 per 7c04261 and c855118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport release/3.11 Backport to release/3.11 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants