Deprecate MongoNamespace#COMMAND_COLLECTION_NAME by jyemin · Pull Request #1786 · mongodb/mongo-java-driver

@jyemin

@jyemin

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR deprecates the COMMAND_COLLECTION_NAME constant in the MongoNamespace class as part of removing legacy wire protocol support. The constant was used for the deprecated OP_QUERY wire protocol, which has been replaced by OP_MSG.

  • Adds @Deprecated annotation to the COMMAND_COLLECTION_NAME constant
  • Updates the documentation to explain the deprecation reason and that no replacement is needed

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@NathanQingyangXu

I just found a naming inconsistency in this MongoNamespace class for the following two private methods:

private static String getCollectionNameFullName(final String namespace)

private static String getDatatabaseNameFromFullName(final String namespace)

given they are private methods, it might be great to add the missing From to the first method.
Not a blocker of the PR, just a comment.

NathanQingyangXu

@NathanQingyangXu

Another super minor but more visible issue is the javadoc of this class:

A MongoDB namespace, which includes a database name and collection name.

I think another a is needed before colleciton name.

A MongoDB namespace, which includes a database name and a collection name.

Too trivial for sure.

@jyemin

Good catches, but I'm going to leave the PR focused on just the deprecation.