strapi-plugin-multi-select icon indicating copy to clipboard operation
strapi-plugin-multi-select copied to clipboard

Cant filter with `$in` operator

Open AaronMcCloskey opened this issue 1 year ago • 2 comments

I know you can use $containsi but it doesn't really achieve what I want.

Let's use this example

schema.json

"page": {
  "type": "customField",
  "options": ["My Account:my-account", "Account:account", "Account Edit:account-edit"],
  "customField": "plugin::multi-select.multi-select"
},

HTTP Request

$in

filters[page][$in]=account

Does not return any data, even if I have multiple entries that have account selected

$containsi

filters[page][$containsi]=account

Returns any entries that page value includes the account characters and not only the account value

Current Behaviour

[
    {
        "id": 1,
        "attributes": {
            "page": [
                "my-account"
            ]
        }
    },
    {
        "id": 3,
        "attributes": {
            "page": [
                "account-edit"
            ]
        }
    },
    {
        "id": 5,
        "attributes": {
            "page": [
                "account"
            ]
        }
    }
]

Expected Behaviour using $in

[
    {
        "id": 5,
        "attributes": {
            "page": [
                "account"
            ]
        }
    }
]

At the moment, I can't use this plugin due to this missing feature.

Unless I am missing something. Any help would be greatly appreciated.

AaronMcCloskey avatar Feb 29 '24 16:02 AaronMcCloskey