I have a database like this.

How can I order by the timestamp field in the array?
.orderBy("received[0].timestamp", "desc")
You cannot directly. But what you can do is create a new field on your document called firstTimestamp or something similar, and then replicate the timestamp from the first element of the array into that field. You can do that in a Cloud Function or in your frontend/backend code. That way you can sort or filter by that field.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With