I have been using firebase RTDB and I am going to migrate it to firestore.
I had userIds associated with many other nodes.
For example, I have users
, messages
, purchases
.
To associate user with other collections, I had users_messages/$date/$userId/$messageId
, purchases/$date/$userId/$purchaseId
, because RTDB did not support complex queries and I wanted to be able to query messages between date range for a specific user.
Now I realized firestore is way better than RTDB in terms of data querying, and going to have messages
, purchases
collection with date
and user
.
In this case, should I store userId
or whole user
document in messages
and purchases
collection?