user23424
user23424

Reputation: 71

Making a query to multiple collection in firestore

I have two collections where one collection is referencing another. Below is my structure:

CURRENCY_PAIR

  1. CurrencyPair_Name
  2. CurrencyPair_id

CURRENCY_PAIR_LIMIT

  1. Limit_Currency_Pair_Id : CURRENCY_PAIR/0chTWgOpzolSxj590N1U <=makes a reference to the document in the CURRENCY_PAIR collection
  2. Limit_Buy_Price_Threshhold

How can i query both collections such that when i get a currency pair, it is equal to the Limit_Buy_Price_Threshhold field that was added to the db with.

Upvotes: 0

Views: 1139

Answers (1)

Donnald Cucharo
Donnald Cucharo

Reputation: 4126

As provided on this thread, Firestore does not have a concept of server-side JOIN which is very near to what you want to achieve when you mentioned that you wanted to query both collections.

What I could think of is that you could remodel your database in a way that you can perform collection group queries. It works by putting CURRENCY_PAIR_LIMIT as a subcollection to the document in CURRENCY_PAIR.

Upvotes: 1

Related Questions