Skip to content
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

Poco::MongoDB support for MongoDB 5.0? #3484

Closed
brentd42 opened this issue Dec 22, 2021 · 10 comments
Closed

Poco::MongoDB support for MongoDB 5.0? #3484

brentd42 opened this issue Dec 22, 2021 · 10 comments

Comments

@brentd42
Copy link

The MongoDB wire protocol opcodes used by the POCO MongoDB driver have been deprecated in MongoDB 5.0 (see [https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/#std-label-wp-request-opcodes]). I stumbled across this when attempting to use Poco::MongoDB::InsertRequest to insert a document into a MongoDB 5.0 "time series" collection and it failed to work. These legacy opcodes have been replaced by the OP_MSG opcode introduced in MongoDB 3.6 with the associated wire transfer request and response changes.

Is the migration of the MongoDB driver from using legacy to modern protocols somewhere in the POCO roadmap?

@obiltschnig obiltschnig self-assigned this Dec 22, 2021
@obiltschnig obiltschnig added this to the Release 1.12.0 milestone Dec 22, 2021
@obiltschnig
Copy link
Member

I guess it will have to be done at some point. Contributions welcome.

@aleks-f
Copy link
Member

aleks-f commented May 24, 2022

@matejk could you help with this?

@matejk
Copy link
Contributor

matejk commented Aug 19, 2022

@aleks-f, we will transition to newer Linux distributions until end of this year and we'll also need this. Yes, I can help.

@matejk
Copy link
Contributor

matejk commented Aug 19, 2022

@matejk
Copy link
Contributor

matejk commented Aug 22, 2022

Mongo DB introduced OP_MSG that replaces other messages in version 3.6, current version is 6.0.

Versions older than 3.6 are not supported anymore.

@aleks-f, is it expected that Poco::MongoDB shall support legacy versions of MongoDB, older than 3.6?

If not, then legacy wire messages can be completely replaced with new wire protocol.

@aleks-f
Copy link
Member

aleks-f commented Aug 22, 2022

I don't know

@obiltschnig @fbraem ?

@matejk
Copy link
Contributor

matejk commented Nov 23, 2022

I started to work on this feature in the way that both old and new wire protocol are supported.

@obiltschnig
Copy link
Member

I had planned to work on this as part of a project, but that project got postponed indefinitely unfortunately.

@matejk
Copy link
Contributor

matejk commented Nov 25, 2022

First batch of changes is available on branch

https://github.com/matejk/poco/tree/gh-3484-mongodb-op_msg

in case that someone in interested in providing early feedback.

@matejk
Copy link
Contributor

matejk commented Dec 2, 2022

Required functionality to support MongoDB 5.1 and newer is available on branch:

https://github.com/matejk/poco/tree/gh-3484-mongodb-op_msg

I tested it with MongoDB 6.0.

@obiltschnig , @fbraem: IMO it would be great if someone would take a look at the code and try it before I create a merge request.

aleks-f pushed a commit that referenced this issue Nov 27, 2023
* Binary writer/reader: add writeCString and readCString.

* MongoDB::Database: add queryBuildInfo and queryServerHello; add WireVersion enum.

* MongoDB: Introduce OpMsgMessage (request and reply) and related changes in Connection, Database, MessageHeader.

* MongoDB: First unit test changes for OpMsgMessage.

* MongoDB::Document: new functions addNewArray and remove.

* MongoDB: OP_MSG unacknowledged write and many improvements

* MongoDB: new cursor using OP_MSG

* MongoDB: bunch of new tests for OP_MSG wire protocol.

* BinaryWriter::WriteCString: use write instead of operator <<.

* MongoDB::OpMsgCursor: Slightly modified prototype code for using moreToCome flag.

* MongoDB: Add OpMsg* files to Makefiles.

* MongoDB: Add OpMsg* files to VS project files.

* Compile fixes.

* MongoDB::Database: Add factory function for database commands createOpMsgMessage() and cursors createOpMsgCursor()
@aleks-f aleks-f added the fixed label Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants