Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "-KhWrBcYyMluJbK7QpnK" : {
- "Info" : {
- "Email" : "xyz@gmail.com"
- },
- "Settings" : {
- "Status" : "Accepted"
- }
- },
- "-KhX0tgQvDtDYqt4XRoL" : {
- "Info" : {
- "Email" : "abc@abc.com"
- },
- "Settings" : {
- "Status" : "Accepted"
- }
- },
- "-KhX1eo7uFnOxqncDXQ5" : {
- "Info" : {
- "Email" : "abc@abc.com"
- },
- "Settings" : {
- "Status" : "Pending"
- }
- }
- }
- "Invitation" : {
- ".indexOn": ["Info/Email","Settings/Status"]
- }
- var rootRef = firebase.database().ref().child('Invitation');
- var userInvitations = rootRef.child("Info").orderByChild("Email").equalTo("abc@abc.com");
- var allInvitations = $firebaseArray(userInvitations);
- {
- "-KhWrBcYyMluJbK7QpnK" : {
- "Email" : "xyz@gmail.com",
- "Settings" : {
- "Status" : "Accepted"
- }
- },
- "-KhX0tgQvDtDYqt4XRoL" : {
- "Email" : "abc@abc.com",
- "Settings" : {
- "Status" : "Accepted"
- }
- },
- "-KhX1eo7uFnOxqncDXQ5" : {
- "Email" : "abc@abc.com",
- "Settings" : {
- "Status" : "Pending"
- }
- }
- }
- "Invitation" : {
- "Info" : {
- ".indexOn": "Email",
- },
- "Settings" : {
- ".indexOn": "Status",
- }
- }
- var allInvitations = [];
- var rootRef = firebase.database().ref().child('Invitation');
- var userInvitations = rootRef.orderByChild("Email").equalTo("abc@abc.com");
- userInvitations.on('value', snap => {
- var invitations = snap.val()
- for (prop in invitations ) {
- allInvitations.push(invitations[prop ]);
- }
- console.log(allInvitations);
- })
Add Comment
Please, Sign In to add comment