0

Is it possible to use .equalTo() with a list of values?

this is my database structure

Posts:{postID(key), posterID, description}

Let's say i want to get the records that have postID_A and postID_B. Is there a way to pass a list of keys in the .equalTo() and get all records that match the keys from the list instead of fetching one record then fetch the second one etc?

georgcon
  • 67
  • 11

1 Answers1

1

From the documentation:

equalTo() Return items equal to the specified key or value, depending on the order-by method chosen.

It sounds like what you want to do can be accomplished if you employ these methods (again, all from the documentation):

you can combine multiple limit or range functions. For example, you can combine the startAt() and endAt() methods to limit the results to a specified range of values.

https://firebase.google.com/docs/database/web/lists-of-data#filtering_data

hcs
  • 321
  • 3
  • 14