I have a collection containing posts which are documents containing a timestamp and other data, we could call it global post object.
Whenever an user posts something, a document with the same id as the post id is added to the user's private post collection (under users/userUuid/posts/postId
), let's call it private post object.
Each private post object contains a reference to the global post object (stored as a reference object in the document).
This is the structure:
posts: [
"post1" : {
timestamp: 12000000000
data: "abc"
}
"post2" = {
timestamp: 12000000000
data: "abc"
}
]
users: [
"user1" : {
posts: [
"post1": {
ref: reference to post1
}
]
}
]
I have a screen in which I'm querying all the objects under the user's private post collection. Is it possible to sort those based on the timestamp value of the document they reference?