Use RecordsGetter.getAll with a list of ids

Expected behavior

I would like to do :

const recordsGetter = new RecordsGetter(artists);
const records = recordsGetter.getAll([1, 2, 3]);

And obtain the artists with ids 1, 2 and 3.

Actual behavior

I have an error message because recordsGetter.getAll doesn’t accept arrays.

Context

Please provide any relevant information about your setup.

  • Package Version:
  • Express Version: 4.16.1
  • Sequelize Version: 5.15.1
  • Database Dialect: Postgres SQL
  • Database Version:
  • Project Name:

Currently, I loop on the artist ids array and I use recordGetter.get for each id. I would like to know if you have other ideas.

Thank you very much!

1 Like

Hi @Cyrielle_Willerval,
Glad to see you here in our new community forum!

As a workaround, I would use Sequelize models instead and do something like:

const records = await artists.findAll({ where: { id: [1, 2, 3] });

What do you think of this solution?

2 Likes

Thank you @arnaud for answering so fast! This is exactly what I was looking for :slight_smile:

3 Likes