#Query Exception list of ids

3 messages · Page 1 of 1 (latest)

plush brook
#

Hi,

I've been using MedusaJs for 3 months now, its amazing and I really like the features of it.

I was just wondering if there's an exception functionality in Query, like for example I have list of product ids, and I want those ids to be not fetched.

Thank you in advance for the help

sharp sluice
#

Here's how you can use it to exclude specific product IDs from your query

  entity: "product",
  fields: ["id", "title"],
  filters: {
    id: {
      $nin: ["prod_01", "prod_02", "prod_03"] // List of product IDs you want to exclude
    }
  }
})```
plush brook
#

Exactly what i'm looking for! Thank you very much @sharp sluice