mongodb inspired array filtering