1

I'm creating a facebook like user post database for my app in Firestore. this is structure

Posts(Collection)

(documents)----(data)

-----post_uid1-{ userId: userId1 content: "content1XYZ"}

-----post_uid1-{ userId: userId2 content: "content2XYZ"}

and so on.

I want to perform a query to get posts for a user's all friend.

In SQL I could perfom a SELECT * FROM posts where id in (friendsIds).

In Firestore we have(for JAVA) ref.whereEqualTo("key","value")

but if a user has let's say 100 friends how will I perform this query?

I know we can chain multiple whereEqualTo conditions. but for 100s of values it doesn't seem convenient.

purush
  • 559
  • 3
  • 12
  • Chaining `whereEqualTo` calls is the equivalent of an AND operation, so wouldn't work. There is no way to get multiple documents by their IDs in a single call. See https://stackoverflow.com/questions/46721517/google-firestore-how-to-get-document-by-multiple-ids-in-one-round-trip – Frank van Puffelen Nov 06 '17 at 09:56

0 Answers0