CA
continuing-cyan

How to modify the dataset

I want to modify the dataset, remove all old data and save a modified version of the data as json. Doing await Dataset.pushData(myModifiedData) will add the data but doesnt remove old data
4 Replies
continuing-cyan
continuing-cyanOP2y ago
I tried this
await Dataset.drop()
await Dataset.drop()
but I get TypeError: Dataset.drop is not a function
HonzaS
HonzaS2y ago
you can try:
const dataset = await Dataset.open();
await dataset.drop();
const dataset = await Dataset.open();
await dataset.drop();
quickest-silver
quickest-silver2y ago
yeah, you should .drop() a specific instance, so what Honza says. Keep in mind though - that if you do it on the platform - you will delete dataset entirely - so you would need to open another one before pushing data to it. Dataset is read-only/append-only storage
HonzaS
HonzaS2y ago
and also keep in mind that the new one will have different id

Did you find this page helpful?