Skip to content

Where() and orderBy() not work together on collection  #2047

@infoway9

Description

@infoway9

When I use where() or orderBy() separately that is working fine but when I used combinedly it returns an empty result set. Can anyone tell me why I get this result?

this.authService.afs
      .collection("boards", ref => {
        return ref
          .orderBy('expiryDate')
          .where('moderatorId', '==', this.authService.userId)
      })
      .snapshotChanges()
      .pipe(
        map(actions =>
          actions.map(a => {
            const data = a.payload.doc.data();
            const id = a.payload.doc.id;
            return { id, ...data };
          })
        ),
        catchError(() => of([]))
      ).subscribe(boards => {
        console.log(boards);
        this.userBoardBehav.next(boards);
        this.loadingSubject.next(false);
      });

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions