Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Using SQL ORMs with Node.js Performing CRUD Operations Delete a Record

Seth Missiaen
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Seth Missiaen
Web Development Techdegree Graduate 21,652 Points

Bulk destroy() documentation is missing

The link for documentation on bulk actions is missing. I could not find entries on the Sequelize website for deleting multiple rows at once. I tried to do it my own way and I want to know if there's a more practical way to bulk delete. Here's my code:

    const toDelete = await Movie.findAll({
      where: {
        releaseDate: {
          [Op.lte]: '2007-01-01',
        },
      },
    });

    const deleteSummary = toDelete.map(movie => movie.toJSON() );
    console.log(deleteSummary);

    await toDelete.forEach(movie => {movie.destroy()});

1 Answer

Steven Parker
Steven Parker
229,644 Points

It looks like they have reorganized the documentation by version. The links for the current stable version (v6) are:

You may want to report this to Support, it might get you the "special Exterminator badge".:beetle: