Firebase query if child of child contains a value

Discussão em 'Angular' iniciado por John, Janeiro 3, 2025.

  1. John

    John Guest

    The structure of the table is:

    • chats
    • --> randomId
    • -->--> participants
    • -->-->--> 0: 'name1'
    • -->-->--> 1: 'name2'
    • -->--> chatItems

    etc

    What I am trying to do is query the chats table to find all the chats that hold a participant by a passed in username string.

    Here is what I have so far:

    subscribeChats(username: string) {
    return this.af.database.list('chats', {
    query: {
    orderByChild: 'participants',
    equalTo: username, // How to check if participants contain username
    }
    });
    }

    Continue reading...

Compartilhe esta Página