Skip to content

remove() on AngularFireList does not consider the filter applied #2989

Open
@SlyEzo

Description

@SlyEzo

Version info

Angular: 12.1.1

Firebase: 8.7.0

AngularFire: 6.1.5

Other (e.g. Ionic/Cordova, Node, browser, operating system): N/A

How to reproduce these conditions

Steps to set up and reproduce

  1. Create a list of objects with a "category" property
  2. Add items in the list
  3. Try to remove all objects having a certain value for the "category" property

Example of code

The following piece of code removes all objects regardless of the category property :

removeCategoryQuestions(currentCategory: string) {
  this.db
    .list<Evaluation>(
      `interview-questions/${this.type}`, 
      ref => ref.orderByChild('category').equalTo(currentCategory))
    .remove();
}

However, this piece of code displays only the objects having the right category value :

removeCategoryQuestions(currentCategory: string) {
  const filteredListRef = this.db
    .list<Evaluation>(
      `interview-questions/${this.type}`, 
      ref => ref.orderByChild('category').equalTo(currentCategory));
  filteredListRef.valueChanges().subscribe(evalu => console.log(evalu))
}

Expected behavior

.remove() called on a filtered AngularFireList should remove only the filtered objects.

Actual behavior

.remove() called on a filtered AngularFireList removes all objects, regardless of the filter applied.

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