jiuntian / IssueTrackerAssignment

0 stars 0 forks source link

External Database #15

Closed chimtingshing closed 3 years ago

chimtingshing commented 3 years ago

If we implement external database to store the data. Do we need to read from the json file initially and then consistently update the json file at all times if there are any changes also? Or we read from the database initially and only make changes to the database?

jiuntian commented 3 years ago

since u have external database, no need always update, system could be slow if keep update as it takes a lot file IO. But, JSON file need to update/export on request by users, to dump all data from database into JSON file. JSON data should be able to restore to empty database.

chimtingshing commented 3 years ago

since u have external database, no need always update, system could be slow if keep update as it takes a lot file IO. But, JSON file need to update/export on request by users, to dump all data from database into JSON file. JSON data should be able to restore to empty database.

Since we need to let the users add picture if we are doing GUI, should the pictures be stored into the JSON file in base64? And also, if I then save the initial JSON file as it into mongodb as a document, and then I use the document as my storage of data to read and write from, is this accepted as using external database?

jiuntian commented 3 years ago

You may decide the data structure used to store the images, whether to stored inside JSON file or not, it will be still working. However, storing all the images in the database could flood the database if the number of images is large enough, or if the file size is big enough (ie. someone upload a 1GB image), in this case, you can consider separate file storage. So, make your reasonable choices, although either are acceptable.

If using mongodb, then it is considered using an external database. Make sure you are query on single entity which are necessarily, not the whole document.