javascript - cross-referencing two firebase arrays to obtain data -


i wondering if there's easy way pull out value 1 array based on corresponding name.

enter image description here

here, i've obtained user email "coupons" collection. search through "users" collection, find similar email, , output corresponding "name" ("wes haque enterprises") $scope variable.

i have references both collections , $scope objects have references stored.

i wanted know if there's easy way traverse through $scope.users object looking string "wes@wes.com" , extracting "wes haque enterprises" it. thanks.

assuming don't want iterate (traverse?) on bunch of arrays instead query data need...

you can query users node data need. in macos:

fquery *allusers = [usersref queryorderedbychild:@"emailaddress"]; fquery *thisuser = [allusers queryequaltovalue:@"wes@wes.com"]; [thisuser observeeventtype:feventtypechildadded withblock:^(fdatasnapshot *snapshot) {     ( fdatasnapshot *child in snapshot.children) {         nslog(@"%@", child);     } }] 

the result of query contain "wes haque enterprises"

or

ref.orderbychild("emailaddress").equalto("wes@wes.com").on("child_added", function(snapshot) {   console.log(snapshot.key()); }); 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -