0

enter image description here

I need to fetch the Friends list where

(friendshipStatus == friendshipStatusRequested && senderId == currentUserId)

Seems firebase does not provide support for AND, OR or subqueries. Is there any way to sort out the problem?

user4261201
  • 2,324
  • 19
  • 26
Raj Sharma
  • 1,009
  • 8
  • 15
  • The Firebase Realtime Database only supports ordering/querying on a single property. In many cases you can combine the values that you want to order/filter on into a new, synthetic property and use that in your query. For example: `"friendshipStatus_senderId": "friendshipStatusRequested_9HYZen....BLI2"`. See my longer answer here: http://stackoverflow.com/questions/26700924/query-based-on-multiple-where-clauses-in-firebase – Frank van Puffelen Nov 22 '17 at 15:13

1 Answers1

2

Unfortunately Firebase doesn't support it. What you can do, is create a new attribute friendshipUser with the mix of those two values.

friendshipUser = "friendshipStatusRequested_currentUserId"

Robert D. Mogos
  • 900
  • 7
  • 14