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

Support wire protocol 4 (Server v3.2) #11

Open
1 of 3 tasks
apkar opened this issue Nov 30, 2018 · 9 comments
Open
1 of 3 tasks

Support wire protocol 4 (Server v3.2) #11

apkar opened this issue Nov 30, 2018 · 9 comments
Labels
compatibility Either missing or incompatible features causing driver or tool compatibility enhancement New feature or request
Milestone

Comments

@apkar
Copy link
Contributor

apkar commented Nov 30, 2018

Wire protocol 4 adds

  • find command
    • It is likely this is just same as OP_QUERY. If so, it's a relatively easy task.
  • getMore command
    • It is likely this is just same as OP_GETMORE. If so, it's a relatively easy task as we already support OP_GETMORE.
  • OP_COMMAND
    • This is an internal message sent between Mongo servers. mongos doesn't implement this as well. The client never sends this message. We don't have to implement this.
@apkar apkar changed the title Support wire protocol 4 Support wire protocol 4 (Server v3.2) Jan 6, 2019
@apkar
Copy link
Contributor Author

apkar commented Jan 6, 2019

This is important to be able to use mongo-go-driver with Document Layer. It only supports server versions >= 3.2.

@apkar apkar added enhancement New feature or request compatibility Either missing or incompatible features causing driver or tool compatibility labels Jan 9, 2019
@bartle-stripe
Copy link

There's also the killCursors command to replace OP_KILL_CURSORS. The other thing that 3.2 adds is support for readConcern on query commands (find, count, etc...), though I imagine the document layer can happily ignore that particular option.

One important difference with OP_QUERY and find is when cursors are automatically closed. OP_QURY doesn't support expressing a limit directly (numberToReturn indicates how many documents to return in the initial batch, but doesn't prevent drivers from requesting additional documents in OP_GET_MORE). On the other hand, find has a limit argument that represents the hard limit on the cursor (i.e. the cursor itself will not return more than limit results), and in practice, MongoDB will automatically close cursors when that limit is reached (this saves a roundtrip of having to call killCursors in many cases).

@apkar
Copy link
Contributor Author

apkar commented Feb 21, 2019

Mongo Swift driver, MongoKitten, seems to have the same issue. The latest release, 5.0, has removed support for MongoDB 3.0.

@apkar apkar added this to the 1.7.0 milestone Feb 21, 2019
@likeabbas
Copy link

Any updates on this? I'd be happy to help work on this, just having trouble parsing through the cpp codebase as it's been a few years since I've worked with the language

@apkar
Copy link
Contributor Author

apkar commented Mar 4, 2019

That would be great @likeabbas. We are planning on finishing this before 1.7.0, end of this month. I am just about to start on this issue. If you want to contribute we can find pieces of this issue you can take on. There are so many other issues you can contribute as well.

To start, you could take on couple of simple ones, like #84 and #92. That will give you introduction into code and also gives you chance to setup your development environment.

I am thinking of adding some design documentation. I can use this as an opportunity as well.

@apkar apkar self-assigned this Mar 4, 2019
@apkar apkar modified the milestones: 1.7.0, 1.8.0 Apr 8, 2019
@dongxinEric dongxinEric self-assigned this May 6, 2019
@dongxinEric
Copy link
Contributor

dongxinEric commented Jun 4, 2019

Just wanna clarify that, according to my local tests, mongo-go-driver:v1.0.2 does work with both server 3.0 and 3.2.

@dongxinEric
Copy link
Contributor

I tested the latest MongoKitten lib by running some basic operations and it just worked fine. Will open PR today or tomorrow.

@oemdaro
Copy link

oemdaro commented Sep 3, 2019

Any updates on this? The support for server v3.2 will be release soon?

Thank for hardworking on this. Love this project.

@akira-kurogane
Copy link

As of v5.0 MongoDB Community deprecates the legacy OP_QUERY, OP_UPDATE, etc. write protocol message formats. https://jira.mongodb.org/browse/SERVER-55788

The OP_COMMAND + OP_COMMAND_REPLY ones were an inbetween attempt to have a generic command message type. They were never used by clients, instead OP_MSG was the next began support with v3.6. Related blog post: https://emptysqua.re/blog/driver-features-for-mongodb-3-6/.

To put it another way it was Jan 2020 when v3.4, the last OP_MSG-incompatible server version, was EOL'ed.

So although MongoDB drivers will probably continue to support OP_QUERY etc. for older mongodb server versions for a while yet a MongoDB compatible wire protocol should just move forward to OP_MSG. Offering backward compatibility has been N/A for a year or so already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Either missing or incompatible features causing driver or tool compatibility enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants