Clear Collection Data at once

Hi Jack!

Use this code snippet to delete the items:

function clear() {
    wixData.query("yourCollection")
    .limit(1000)
    .find()
    .then((results) => {
      removeItems(results.items);
        console.log(removeItems);
});
}

async function removeItems(items) {
 await items.forEach(async (item, i) => {
                $w('#text1').text = String(i);
 await wixData.remove("yourCollection", items[i]._id);
    });
}

Remember to adjust the field keys/collection names to fit your site.
Note that the query by default returns only the 50 first items, therefor make sure to change the limit of the query to up to 1000.

Hope it helps!

Doron. :slight_smile: