You should provide the filter in the request and not through a loop in the code here. I assume this is in a controller so you should have something like strapi.services.post.find() in the controller and you can pass in some filters to that so something like strapi.services.post.find({ "user_groups": ctx.state.user["user_groups"].id })