System Information
- Strapi Version: 3.4.0
- Operating System: MacOS
- Database: MongoDB
- Node Version: v14.15.3
Hi there,
how i can populate only nested field from collection
?
Model
"attributes": {
"admin": {
"plugin": "users-permissions",
"model": "user",
"via": "restaurant"
},
"users": {
"plugin": "users-permissions",
"collection": "user",
"via": "restaurant"
}
}
Original query
populate = [];
// model, working as well, returned only user id in admin field
populate = ['admin.id'];
// collection, working as well, returned all populated users with nested fields
populate = ['users'];
// collection, but how i can get only users.id from collection?
populate = ['users.id'];
strapi.query('restaurant').findOne({ id: params.id }, populate);
Expected result
{
admin: ID,
users: [ID, ID, ID], // not user model
}