One thing I was trying to figure out lately is if it was possible to filter a collection from an array of id’s. Imagine you got a task model that lists another sub-task model. In your task model you got an array of sub-tasks, [1,4,7]. How would you go to retrieve those models?
The easiest way of doing this is by looping the array and saving the models one by one in a new collection.The code in your… Read the rest
Filtering a collection can seem a daunting task the first time, but this is in fact, really easy. There is more than one way to filter collections, here I wanted to present the solution that work best for me. Do not hesitate to comment on it, I’m always happy to improve my stuff.
Of course this post would not be complete without a little live demo
Setup the Collection
My favorite way of declaring a filter is doing it… Read the rest