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

feat(JMongosh): evaluate distinct using runCommand to allow values of different types in result array #1076

Merged

Conversation

kornilova203
Copy link
Collaborator

@kornilova203 kornilova203 commented Aug 24, 2021

No description provided.

@addaleax
Copy link
Contributor

addaleax commented Aug 24, 2021

Looks like this fails with a 4.0.x server:

 [2021/08/24 14:04:35.632] com.mongodb.mongosh.CollectionTest > testDistinct FAILED
 [2021/08/24 14:04:35.632]     org.junit.ComparisonFailure: expected:<[[ 1, 2, 3 ]
 [2021/08/24 14:04:35.632]     [ "hello", "world" ]
 [2021/08/24 14:04:35.632]     [ 1, 2, "hello" ]
 [2021/08/24 14:04:35.632]     [ 1 ]
 [2021/08/24 14:04:35.632]     [ { }, { "a": 1 } ]
 [2021/08/24 14:04:35.632]     [ "hello" ]]
 [2021/08/24 14:04:35.632]     [ "caf\u00E9" ]> but was:<[com.mongodb.MongoCommandException: Command failed with error 14 (TypeMismatch): '"collation" had the wrong type. Expected object, found null' on server %mongohostport%. The full response is {"ok": 0.0, "errmsg": "\"collation\" had the wrong type. Expected object, found null", "code": 14, "codeName": "TypeMismatch"}
 [2021/08/24 14:04:35.632]     com.mongodb.MongoCommandException: Command failed with error 14 (TypeMismatch): '"collation" had the wrong type. Expected object, found null' on server %mongohostport%. The full response is {"ok": 0.0, "errmsg": "\"collation\" had the wrong type. Expected object, found null", "code": 14, "codeName": "TypeMismatch"}
 [2021/08/24 14:04:35.632]     com.mongodb.MongoCommandException: Command failed with error 14 (TypeMismatch): '"collation" had the wrong type. Expected object, found null' on server %mongohostport%. The full response is {"ok": 0.0, "errmsg": "\"collation\" had the wrong type. Expected object, found null", "code": 14, "codeName": "TypeMismatch"}
 [2021/08/24 14:04:35.632]     com.mongodb.MongoCommandException: Command failed with error 14 (TypeMismatch): '"collation" had the wrong type. Expected object, found null' on server %mongohostport%. The full response is {"ok": 0.0, "errmsg": "\"collation\" had the wrong type. Expected object, found null", "code": 14, "codeName": "TypeMismatch"}
 [2021/08/24 14:04:35.632]     com.mongodb.MongoCommandException: Command failed with error 14 (TypeMismatch): '"collation" had the wrong type. Expected object, found null' on server %mongohostport%. The full response is {"ok": 0.0, "errmsg": "\"collation\" had the wrong type. Expected object, found null", "code": 14, "codeName": "TypeMismatch"}
 [2021/08/24 14:04:35.632]     com.mongodb.MongoCommandException: Command failed with error 14 (TypeMismatch): '"collation" had the wrong type. Expected object, found null' on server %mongohostport%. The full response is {"ok": 0.0, "errmsg": "\"collation\" had the wrong type. Expected object, found null", "code": 14, "codeName": "TypeMismatch"}]
 [2021/08/24 14:04:35.632]     [ "caf\u00E9" ]>
 [2021/08/24 14:04:35.632]         at org.junit.Assert.assertEquals(Assert.java:115)
 [2021/08/24 14:04:35.632]         at org.junit.Assert.assertEquals(Assert.java:144)
 [2021/08/24 14:04:35.632]         at com.mongodb.mongosh.UtilKt.compare(util.kt:168)
 [2021/08/24 14:04:35.632]         at com.mongodb.mongosh.UtilKt.access$compare(util.kt:1)
 [2021/08/24 14:04:35.632]         at com.mongodb.mongosh.UtilKt$doTest$4.invoke(util.kt:95)
 [2021/08/24 14:04:35.632]         at com.mongodb.mongosh.UtilKt$doTest$4.invoke(util.kt:69)
 [2021/08/24 14:04:35.632]         at com.mongodb.mongosh.UtilKt.withDb(util.kt:146)
 [2021/08/24 14:04:35.632]         at com.mongodb.mongosh.UtilKt.doTest(util.kt:69)
 [2021/08/24 14:04:35.632]         at com.mongodb.mongosh.CollectionTest$test$1.invoke(CollectionTest.kt:78)
 [2021/08/24 14:04:35.632]         at com.mongodb.mongosh.CollectionTest$test$1.invoke(CollectionTest.kt:77)
 [2021/08/24 14:04:35.632]         at com.mongodb.mongosh.ShellTestCase.withShell(ShellTestCase.kt:29)
 [2021/08/24 14:04:35.632]         at com.mongodb.mongosh.CollectionTest.test(CollectionTest.kt:77)
 [2021/08/24 14:04:35.632]         at com.mongodb.mongosh.CollectionTest.testDistinct(CollectionTest.kt:28)

@kornilova203 kornilova203 force-pushed the JMongosh/disting-using-runCommand branch from be44652 to 658758c Compare August 25, 2021 10:12
@kornilova203
Copy link
Collaborator Author

@addaleax, pushed fix

@addaleax addaleax merged commit dad9725 into mongodb-js:main Aug 25, 2021
@kornilova203 kornilova203 deleted the JMongosh/disting-using-runCommand branch August 25, 2021 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants