penguru
penguru

Reputation: 4380

Howto order by inner element in Firestore

I'm trying to get firestore data ordered by progress[0].score.

I could not figure out how I can pass this info to orderBy method of collection.

enter image description here

Upvotes: 1

Views: 48

Answers (1)

DIGI Byte
DIGI Byte

Reputation: 4148

this kind of feature isn't available to the Firebase console, it is merely rendering your data in a generic format that favors alphanumeric sorting. any filters you apply in the Firebase web console does not affect how it is received within your clients app and would require additional sorting.

for example:

const list = snapshot.data().progress.sort((a,b)=> a.level - b.level)

Upvotes: 1

Related Questions