Closed
Description
I accidentally found a case when FerretDB and Proxy give different results for the same embedded array query.
Data in the database:
{ _id: 'array-embedded', value: [ [ "42", "foo" ] ] }
Query:
{ value: ["42", "foo"] }
Proxy found array-embedded
item.
FerretDB didn't find it and returned an empty response.
To demonstrate the case I added a tiny test in #708.
When I run it with proxy the test pass:
$ go test -timeout 90s -run ^TestQueryArrayEqual$ github.com/FerretDB/FerretDB/integration -v -count=1 -port=37017
=== RUN TestQueryArrayEqual
=== PAUSE TestQueryArrayEqual
=== CONT TestQueryArrayEqual
2022-06-07T17:34:42.946+0200 INFO debug debug/debug.go:60 Starting debug server on http://127.0.0.1:65311/
=== RUN TestQueryArrayEqual/Embeded
=== PAUSE TestQueryArrayEqual/Embeded
=== CONT TestQueryArrayEqual/Embeded
--- PASS: TestQueryArrayEqual (0.11s)
--- PASS: TestQueryArrayEqual/Embeded (0.01s)
PASS
ok github.com/FerretDB/FerretDB/integration 0.356s
When I run it with FerretDB the test fails:
$go test -timeout 90s -run ^TestQueryArrayEqual$ github.com/FerretDB/FerretDB/integration -v -count=1 -port=27017
=== RUN TestQueryArrayEqual
=== PAUSE TestQueryArrayEqual
=== CONT TestQueryArrayEqual
2022-06-07T17:34:09.033+0200 INFO debug debug/debug.go:60 Starting debug server on http://127.0.0.1:65300/
=== RUN TestQueryArrayEqual/Embeded
=== PAUSE TestQueryArrayEqual/Embeded
=== CONT TestQueryArrayEqual/Embeded
query_array_test.go:56:
Error Trace: query_array_test.go:56
Error: Not equal:
expected: []interface {}{"array-embeded-special"}
actual : []interface {}{}
Diff:
--- Expected
+++ Actual
@@ -1,3 +1,2 @@
-([]interface {}) (len=1) {
- (string) (len=21) "array-embeded-special"
+([]interface {}) {
}
Test: TestQueryArrayEqual/Embeded
=== CONT TestQueryArrayEqual
setup.go:118: Keeping database "testqueryarrayequal" and collection "testqueryarrayequal" for debugging.
--- FAIL: TestQueryArrayEqual (0.18s)
--- FAIL: TestQueryArrayEqual/Embeded (0.02s)
FAIL
FAIL github.com/FerretDB/FerretDB/integration 0.382s
FAIL