Search not returns Instances. Returns Json Objects
I was working with this lib. And following the example in the documentation. I'm doing:
Bike.$search({ brand: 'Trek' })
The return is ok, a list with all possible bikes with the brand. But, what happen now If I wanna modify each element of the list and update it?. The return is just a list of Json Objects. But I think it must return a List of instances of Bikes instances.
- If I try with
Bike.$build()it will do a new instance, and then Bike.$save(). - But if I try with
Bike.$find()for each instance of the list is not elegant and efficient.
I think the $save() can evaluate if the Instance have an Id and do an UPDATE or if have not id do a POST. Or the list must be a list of Bikes instances.
The result of Bike.$search({brand: 'Trek'}) should be a restmod Collection. A Collection contains individual instances of Bike. What does more of your code look like?