How to wipe db records that have forward slash in Node?

How do I wipe or empty the database?

I have a weird bug where I created keys that have forward slashes in them, and now I can’t delete those records.

I’m using Node JS. I tried:

db.delete('/new/new2').then(()=>{console.log('deleted'})
const Database = require("@replit/database");
const db = new Database();
const { AsyncLocalStorage } = require("async_hooks");
// empties db
db.empty().then(()=>{console.log("emptied");process.exit()});

Neither works.

It won’t hit all of the keys (If they match certain conditions), but 99% of keys can be erased by doing replit nuke --i-am-sure in the Shell tab.

2 Likes

are you aware of such conditions? is it a superset of the following regex? /.*?

2 Likes

Any keys that become invalid (such as starting with a /) cannot be modified. I have a PR to fix one such set of keys on Replit’s python repo:

2 Likes

Interesting how there is that undocumented limitation on the keys. Anyone care to speculate why that is the case?

Also, replit nuke didn’t work. What now?

If you have keys that start with a forward slash, then you simply cannot remove those keys. It is a known bug in Replit’s database setup.