I would like to read the entire Firebase database into a variable from inside a backend Cloud Function, as follows:
exports.transformUserData = functions.https.onRequest((request, response) => {
admin.database().ref('/').on('value', function (snapshot) {
var dbData = snapshot.val();
...
});
...
});
It is technically totally possible to read all data from your Firebase Database into memory.
As long as the hosting process has enough memory available this will work. If there is not enough memory, the script will crash.
It is impossible to say at what amount of memory this will crash, since this depends on the JSON data size, the data format (many small nodes will use more memory than one big node), and other factors.