Skip to content

Added regression tests for "number" alias in $$type operator. #1692

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
Apr 29, 2025

Conversation

rozza
Copy link
Member

@rozza rozza commented Apr 28, 2025

@rozza rozza requested review from a team and NathanQingyangXu and removed request for a team April 28, 2025 16:03
@@ -158,7 +159,12 @@ private void assertValuesMatch(final BsonValue initialExpected, @Nullable final
private void assertExpectedType(final BsonValue actualValue, final BsonValue expectedTypes) {
List<String> types;
if (expectedTypes.isString()) {
types = singletonList(expectedTypes.asString().getValue());
String expectedType = expectedTypes.asString().getValue();
if (expectedType.equals("number")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Discussion only. Nothing needs to be done.

I know in this specific case, expectedfType can't be null, but generally speaking, it is a good practice to put string constant to the left hand side of equals() method to avoid NPE.

if ("number".equals(expectedType)) {

Not a big deal for sure.

@NathanQingyangXu
Copy link
Contributor

LGTM. Tested successfully locally.

@rozza rozza merged commit bd30e83 into mongodb:main Apr 29, 2025
2 of 3 checks passed
@rozza rozza deleted the JAVA-5682 branch April 29, 2025 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants