Retrieve several models

Hi ! I would like to retrieve sereval models in one call but I can’t by if there is a method to do so.

Something like that :

const ids = [1, 2, 3];
sports.findByPk(ids).then(sports => {
    // do something

Is there a way to do this ?

Hello @Aurelien and welcome to the ForestAdmin community.

findByPk will expect its parameter to be the (unique) identifier of an object in database.

To fetch multiple items, you can do something like:

  where: {
    id: ids,

You can find more info there or in the Sequelize documentation here

Hope this helps.


That is perfect, thanks a lot !

1 Like