Firebase filtering data

Hello guys! I am trying to filtering my data from my firebase database but i cant filter based on two values:

  this.firebasedb.list("/tavak/").subscribe(_data => {
   this.toadatok = _data.filter(item => {
     item.approved == "1";
     item.megye == this.megyevalasztas
   });
 })

If i try to filter by one value, it is working with both of them (ofc the data is correct for both of the filters)

  this.firebasedb.list("/tavak/").subscribe(_data => {
    this.toadatok = _data.filter(item =>
      item.approved == "1"
    );
  })

Where did i make a mistake in the filtering?

Filter expects a boolean result, which I’m surprised it hasn’t thrown an error for, so you’d want to do:

   this.toadatok = _data.filter(item =>item.approved == "1" && item.megye == this.megyevalasztas);
1 Like

thank you very much!