- Strapi Version: 3.5.3
- Operating System: macOs Catalina 10.15.7
- Database: MongoDB
- Node Version: 14.16.1
- NPM Version: 6.14.12
- Yarn Version:
I have a flow model with the following fields, which I want to return only specific fields in find query:
I also populate an extra property to each result json in afterFind hook.
This discussion 1115 helped me to select “flowJson” field with projection, as below:
But the problem is that using strapi.query.model(‘flow’).find() does not run lifecycle hooks. So how would I return specific fields, while also running lifecycle methods?