I have been using heroku to host my bot and it would normally store data in .json files, however it does not write and store to them as github also isn't a database site, is it possible to host my discord bot from heroku and it still edits my database within Mongodb and retrieves so no data is lost?
Yes. Since you can send external requests to outside connections from Heroku, you can easily communicate with MongoDB Atlas using Heroku to host your app.
Reference: How to use Atlas on Heroku