The if here is not necessary, because in the toArray it is checked again. Same for the $filter