Faouzi
Faouzi

Reputation: 1

how to filter inside Included model using Looback REST URL?

I want to do include with filters based on REST REQUEST. Something like :

Albums?filter=[include][favorites]&filter[where][favorites.type]=abc

I am using MYSQL connector.Any help would be greatly appreciated.

Thanks

Upvotes: 0

Views: 92

Answers (1)

Raymond Feng
Raymond Feng

Reputation: 1536

It's not possible to filter the model based on included items directly. But you can have a few options here:

  1. Set up a remote hook to remove entries that don't match the included items. See http://docs.strongloop.com/display/LB/Remote+hooks.

  2. Create custom method that call Album.find with include and remove entries that don't match the included items. See http://docs.strongloop.com/display/LB/Remote+methods.

Upvotes: 1

Related Questions