How could we implement "in" query in custom controller

How could we implement “in” query in custom controller? I need to select records based on set of ids from a collection. Using MongoDB as backend.

Your inputs highly appreciated.

Kind Regards,
Basu

Hi @basavarajdodamani

You should be able to do this in a controller using the service strapi.services.somemodel.find({ in: [1,2,3] }) (given I’m using SQL ids here, but you should be able to swap this out for mongo ObjectIDs)

1 Like