Mumuji

@mumuji1723 (0)
mumuji1723
mumuji1723
shared a Post
4 months ago
1
Replit database check if key exists
Ask
I am trying to do a discord bot, so far so good, but i have only one problem: How can i check if the key i am trying to access exists in the replit da
Read full post
WWEMONSTERMONST
WWEMONSTERMONST You can use the following code to get all the keys and check if some key exists or not: // first statement gives the list of keys var keys = db.list().then(keys => { // The function to check if a certain key exists or not and do something. if (keys.includes('key')) { console.log('Key exists'); // do something } else { console.log('Key does not exist'); // do something }; }); Hopefully I was able to help you.4 months ago