Pre/Post images processing using mongocxx driver

Hi!
I’ve long waited for mongo 6.0 release to start using the pre-image feature in change streams.
I upgraded my mongo version but I noticed that the mongocxx does not support this new feature yet.
Is there a workaround to still read the pre-image data using mongocxx 3.6.6 version?

Also, I tried doing a POC with pymongo and got into the same issue - 4.2.0 should support it but I can’t seem to be able to upgrade to it (currently latest I can install is pymongo 4.1.1)

What is stopping you from upgrading PyMongo to 4.2?

1 Like

Hi @Bernie_Hackett, thanks for the reply!
when running:
python3 -m pip install --upgrade pymongo==4.2.0
I get:

ERROR: Could not find a version that satisfies the requirement pymongo==4.2.0 (from versions: 0.1rc0, 0.1.1rc0, 0.1.2rc0, 0.2rc0, 0.3rc0, 0.3.1rc0, 0.4rc0, 0.5rc0, 0.5.1rc0, 0.5.2rc0, 0.5.3rc0, 0.6, 0.7, 0.7.1, 0.7.2, 0.8, 0.8.1, 0.9, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.9.5, 0.9.6, 0.9.7, 0.10, 0.10.1, 0.10.2, 0.10.3, 0.11, 0.11.1, 0.11.2, 0.11.3, 0.12, 0.13, 0.14, 0.14.1, 0.14.2, 0.15, 0.15.1, 0.15.2, 0.16, 1.0, 1.1, 1.1.1, 1.1.2, 1.2, 1.2.1, 1.3, 1.4, 1.5, 1.5.1, 1.5.2, 1.6, 1.7, 1.8, 1.8.1, 1.9, 1.10, 1.10.1, 1.11, 2.0, 2.0.1, 2.1, 2.1.1, 2.2, 2.2.1, 2.3, 2.4, 2.4.1, 2.4.2, 2.5, 2.5.1, 2.5.2, 2.6, 2.6.1, 2.6.2, 2.6.3, 2.7, 2.7.1, 2.7.2, 2.8, 2.8.1, 2.9, 2.9.1, 2.9.2, 2.9.3, 2.9.4, 2.9.5, 3.0, 3.0.1, 3.0.2, 3.0.3, 3.1, 3.1.1, 3.2, 3.2.1, 3.2.2, 3.3.0, 3.3.1, 3.4.0, 3.5.0, 3.5.1, 3.6.0, 3.6.1, 3.7.0, 3.7.1, 3.7.2, 3.8.0, 3.9.0, 3.10.0, 3.10.1, 3.11.0, 3.11.1, 3.11.2, 3.11.3, 3.11.4, 3.12.0, 3.12.1, 3.12.2, 3.12.3, 4.0, 4.0.1, 4.0.2, 4.1.0, 4.1.1)
ERROR: No matching distribution found for pymongo==4.2.0

Anyway, I was able to do a POC with mongosh, but I still want to have this working with mongocxx - any idea would be appreciated.

That’s odd. Installation works fine for me locally:

sigstop@devbox ~ $ python -m venv installtest
sigstop@devbox ~ $ source installtest/bin/activate
(installtest) sigstop@devbox ~ $ which python3
/home/sigstop/installtest/bin/python3
(installtest) sigstop@devbox ~ $ python3 -m pip install --upgrade --no-cache-dir pymongo==4.2.0
Collecting pymongo==4.2.0
  Downloading pymongo-4.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.9/479.9 kB 6.9 MB/s eta 0:00:00
Installing collected packages: pymongo
Successfully installed pymongo-4.2.0
(installtest) sigstop@devbox ~ $ python3 --version
Python 3.10.7

What version of Python are you using on which operating system?

For the C++ driver, this feature has been implemented and committed to the master branch of the driver. It will be released in version 3.7.0, which will be out soon.

2 Likes

You may be running into a bug in pip. It would be helpful to post your pip version: python3 -m pip --version

Please upgrade to the latest pip and then try to install pymongo 4.2 again: python3 -m pip install --upgrade pip

2 Likes

Thanks for the replies!
@Bernie_Hackett
do you have a time estimation for 3.7.0 release?

@Shane this is the output:

python3 -m pip --version
pip 21.3.1 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)

Aha. PyMongo 4.2.0 only supports Python 3.7+. We hope ro release C++ driver 3.7.0 in the next week or so.

1 Like