I'm developing a JS system with Node server and need to save images in MongoDB in a way that saves as much space as possible, and I'm currently converting the image to Base64 String and saving as an attribute of a document in the collection.
But with a few photos (Full HD, 4K, 8K), the bank was 350MB in size, it was about 15 photos.
In addition to this method there is another one where the image is uploaded to a server folder and the path and image name are saved only.
I want to save server space because it will be deployed to the Google Cloud Platform, and I do not want to have extra costs just because of photos.
My question is: What methods other than those mentioned above exist to save an image in MongoDB as efficiently as possible ??
Note: I can not post the code because I have it only on the company computer