Reputation: 547
Not much to add. I get that arrays are stored as maps under the hood in Firestore, and I've read the blog post. However, is it guaranteed that if I make a request and get a DocumentSnapshot
, values which are arrays will be in the order they are stored in Firestore? Thank you in advance.
Upvotes: 8
Views: 1292
Reputation: 599061
The blog post you linked is for Firebase's Realtime Database, not for Cloud Firestore.
But in the case of the order of items in arrays, they both work the same and indeed return the items in the order in which they were added.
So: yes, the items in an array field in a DocumentSnapshot
that you read from Firestore are in the same order that you added them to the array.
Upvotes: 11