Skip to content

Bug with querying overlaping string arrays #183

Closed
@adam8797

Description

@adam8797

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"]}}}}

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions