DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Data Engineering
  3. Data
  4. Firebase Advance Querying Join Reference

Firebase Advance Querying Join Reference

In this post, we go over how to use the Firebase querying system to create a query that will join two different references.

Ezequiel Reyno user avatar by
Ezequiel Reyno
·
Mar. 17, 17 · Tutorial
Like (5)
Save
Tweet
Share
33.26K Views

Join the DZone community and get the full member experience.

Join For Free

What’s up guys, Eze is here. I already did a couple of posts about Firebase and how to use the Real-Time database and the storage with AngularJS, in case you missed it you can check here. Today, I want to give you more details on how to do an advanced query to join two references.

Let's suppose we have the schema below and we want to retrieve the list of orders.

database_schema.png

To do that we just need to do as we did several times in our previous examples and attach to the  child_added  event as I did in the code below. As you can see, we get the data under the path orders, but we still need to show the data under the path users which is linked to our orders.

query_first

In the code below, we now changed the query in order to get the user data from the path users. It's important to highlight that this time I'm using the method once, which will retrieve the data just once. Also important to note is that this data is not going to be live data, so we are not going to receive notification if this data changes. There is another way to get the data in real time, but we need to keep the reference to get rid of the connection when we no longer need it. But again, if you don't really need the related data in real time you can use this easy way to join two references.

query_second.PNG

For a complete reference of Firebase use this link. For a complete list of querying functions, you can use this link.

If you found this post useful, please don't forget to press the like button and share it. If you are in doubt, don't hesitate to ask a question and, as always, thank you for reading.

Joins (concurrency library) Firebase Data (computing)

Published at DZone with permission of Ezequiel Reyno. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • A Beginner's Guide to Back-End Development
  • Integration: Data, Security, Challenges, and Best Solutions
  • How To Convert HTML to PNG in Java
  • How Observability Is Redefining Developer Roles

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: