question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug with querying overlaping string arrays

See original GitHub issue

Note: 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:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
matteobortolazzocommented, Jun 20, 2023

Pushed on dev

0reactions
adam8797commented, Jun 20, 2023

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found