Skip to content

Match array query doesn't work the same as Mongo #17

@mattbishop

Description

@mattbishop

Mongo has the ability to search for a specific array value, meaning arrays that have the same elements in the same order:

https://docs.mongodb.com/manual/tutorial/query-arrays/#match-an-array

If I run a similar query with mongo-query-to-postgres-jsonb, I get back results that have all of the array elements, but the ordering is irrelevant. Given the Mongo tutorial example, if I have the same data in jsonb tables, then issue this query:

const sql = mongoToPostgres("inventory", { tags: ["red", "blank"] }, ["tags"]);

Instead of getting back a single result, 4 rows are returned, which is the behaviour for the $all operator. I would expect four results for this query:

const sql = mongoToPostgres("inventory", { tags: { "$all": ["red", "blank"] } }, ["tags"]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions