I have this firebase document, and I want to order by the text field from the first element of the name array, so the official name.
Here is the code I am trying to use, but it's not working:
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[]>;
}