I have a firebase document that I need to sort by the text field associated with the first element in the name array, which is the official name.
https://i.sstatic.net/TVcC9.png
Despite my efforts, the following code isn't producing the desired result:
get(collectionName: string): Observable<T[]> {
return this.afs.collection(collectionName, ref => {
let query: CollectionReference | Query = ref;
query = query.orderBy('text', 'asc').where('name', 'array-contains', 'official');
return query;
}).valueChanges() as Observable<T[]>;
}