← Back to Community
huge issue after saving the data into json file or sql file
Profile icon

Hello guys,

please could anyone give us some help with our code.

We are making a discord study bot that runs timers for students and save their work and study timer into a database.

First when we run the bot, the bot works perfectly but after random amount of time or random amount of use the bot clears the database or edit it randomly(scatter), we tried a lot to know what is going on by changing the saving method from saving to SQL to saving to JSON file but unfortunately is issue is still the same.

The console is not giving any errors at all

Please if you know the issue help us.

Thanks for all

before the issue

Screenshot 2021-05-24 192146

after the issue


Answered by xfinnbar [earned 5 cycles]
View Answer
Profile icon
Profile icon

This happens as the replit file system is not meant for saving anything but your code and assets. If you want to store data, you can use either replit DB (for smaller projects, behaves almost the same as a JSON file), Google Firstore (for medium projects) or MongoDB (for big projects).

Profile icon

@xfinnbar do you mean that our code does not have any issues but replit does not save anything outside the replit DB database?

Profile icon

@AbdulrahmanShaw Replit deletes any changes made by the program. I advise you to use an external database such as mongodb.

Profile icon

thanks for all of you guys @ch1ck3n @JamesGordon1 @xfinnbar

Profile icon

from what I cant tell this is not a problem with your code it is a problem with repl, what looks to be happening is that some of the older requests are being held back, and then writing over the new info with the older false info. I will provide a youtube link explaining it better later today

Profile icon

Hey, sometimes we face these coding problems while working. But if you want to check Best Logo Design Software In 2022 - Logo Design Team then you can visit this website. Here you will find the experts who can help you with this problem of yours.