Created
December 29, 2017 18:38
-
-
Save katowulf/0da6fa749aea3818555926526ca7bd98 to your computer and use it in GitHub Desktop.
Structure Realtime Database data for querying nested fkeys. See https://groups.google.com/d/msgid/firebase-talk/8c3ff322-c106-490e-8de1-d121857c5506%40googlegroups.com.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"albums": { | |
"key1": { | |
"owner": "uid1", | |
"subscribers": { | |
"uid1": true, | |
"uid2": true | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Since we've used the unique identifier instead of a push id, we can query as follows | |
const query = firebase.database().ref('albums').orderByChild('subscribers/uid1').equalTo(true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment