Search code examples
mongodbgoogle-cloud-storagegoogle-cloud-runmongodump

How to use cloudrun to perform mongodump to cloudstorage?


i use node server running in cloudrun, i want to use node-mongotools npm package to download db dump as described in https://www.npmjs.com/package/node-mongotools into google cloud storage. since cloudrun being serverless there is instance disk access. is there a way to stream dump to cloud storage as dump is being created.

end goal is to create mongodb dump into cloud storage using cloudrun

can anyone suggest any other solution to achieve the same.


Solution

  • In serverless, you haven't access to disk, yet. But you can store the data in memory, (up to 8Gb of memory for now, soon more).

    Thus, you can export a collection in memory and then upload it to Cloud Storage. Delete the collection (cleanup the memory) et repeat the action on the next collections.

    There are no blocker here, as long as you stay in the memory limit.