Bug with querying overlaping string arrays
See original GitHub issueNote: I’m working on a minimum working example of this bug, but I may not get to it. If you want to delay triage until then, thats understandable.
We’ve got a model class
public class MyDocument : CouchDocument
{
// ...
public List<string> Tags { get; set; }
// ...
}
A query that I run elsewhere:
public async IAsyncEnumerable<MyDocument> Get(params string[] matchTags)
{
var query = Coutext.MyDocuments.AsQueryable();
// ...
query = query.Where(x => x.Tags.Any(y => y.In(searchTags)));
// ...
await foreach (var model in query.ToAsyncEnumerable())
{
yield return model;
}
}
If I print out mango queries before execution, I see this as the Mango Query for Get("Foo", "Bar"):
{{"selector":{"Tags":{"$elemMatch":{:{"$in":["Foo","Bar"]}}}}}}
This is invalid. I would expect the following query:
{"selector":{"Tags":{"$elemMatch":{"$in":["Foo","Bar"]}}}}
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Array overlaps an array in Postgres
I think you're looking for the "overlaps" operator: && overlap (have elements in common) ARRAY[1,4,3] && ARRAY[2,1] -- True.
Read more >Unable to query for array equality · Issue #2462 · mikro-orm ...
The issue seems to be in formatQuery under platform. It doesn't consider arrays at all, so any arrays are just automatically stringified.
Read more >Check for overlaps for several arrays in one query
Looping through the input array and make a query for each its item is not an option, I want to fire as few...
Read more >Grouping by overlapping arrays, transitively, without ...
1 Answer 1 ... One of the key parts of Jack Douglas's solution in Group by array overlapping is the | (pipe) operator...
Read more >How to handle Overlapping of array objects in node js - Edureka
I am getting an array in request body like : [ { "month": "JUL", ... This input has two parameters (month:enum and year:string)....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Pushed on dev
Preliminary tests look good! I’ll try and run something more rigorous tomorrow, but my functions which were broken just work correctly now.