1
votes

I wanna pull whole data from the firebase database and access that without change data.

firebase.database().ref(‘someBigNode’).once(‘value’, (snapshot) => {
    //do something
}

But it will cost many memory.

May I ask how to pull whole data partially and save memory?

1

1 Answers

4
votes

When you read data from Firebase Database with the JavaScript (or iOS or Android) SDK, it will always read complete nodes. So the only way to retrieve less data is to retrieve a node lower in the JSON tree.

If you find you need to retrieve a part of each node under someBigNode, you should split that part of each node out into a top-level node of their own importantBitsOfSomeBigNode.

It's unfortunately hard to be more helpful without a more concrete example of your data structure and the bits you're trying to retrieve (and the reason why those bits are special).