You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@xandev This happens because byte[] is implicitly converted to a BsonValue of type Binary, which completely breaks the comparison - this doesn't happen with int[] or short[] because they are converted to a BsonArray containing the ids as ints.
I'm not sure there's anything that could be done regarding this - I couldn't think of anything, at least.
@xandev I found a simple way to make your example work. A lambda expression like c => ids.Contains(c.Id) becomes ITEMS(@p0) ANY = $._id when converted to a BsonExpression, so the solution was to make the ITEMS method return every byte in the byte[] cast to int.
This fix will be present in the next incremental release.
Version
LiteDB 5.0.7
Windows 10
.NET Core 3.1
Describe the bug
Using Query() from Collection and Contains() of byte array in Where() returns wrong results.
Code below clearly shows the problem.
Code to Reproduce
https://pastebin.com/ea6xAAdF
Additional context
Using something other than byte array in Where() works perfectly for example array of ints, lists etc.
The text was updated successfully, but these errors were encountered: