Mark
Mark

Reputation: 23

Firebase: data snapshot of all children expect one

This is how my data structure looks like enter image description here

I would like to read all data in docs, except editor inside individual doc ids. is there a way to exclude a child data while doing a data snapshot?

Upvotes: 0

Views: 62

Answers (1)

Renaud Tarnec
Renaud Tarnec

Reputation: 83068

No you cannot get only a subset of the data contained by a DataSnapshot.

If you want to keep the editor value "secret", you should duplicate your data structure in another node (see example below) and apply some specific security rules on this new node.

- docs
   - -LBWkGg....
     - name  //note that the editor node is absent
     - owner
     - ....
   ....
- secretData
   - -LBWkGg....   //same Unique ID as the parent doc
     - editor
   ....
     - ....
   ....

Upvotes: 3

Related Questions