Populate findeOne function

System Information
  • Strapi Version: 4.0.5
  • Operating System: Mac OSX
  • Database: MySQL
  • Node Version: 14.18.3
  • NPM Version: 6.14.15
  • Yarn Version: 1.22.10

Good evening,

today is my first day using strapi v4.

I am developing a web application for which I want to use strapi. A user can register on the site and be assigned to different locations and RFIDs.

I have created this with multiple relations, using two one-to-many relations for each many-to-many relation.

Now when I query the user, I get the direct relations, but not the additional information from each relation.

Below you will find the strapi-server.js for the users-permissions plugin:

module.exports = plugin => {
  const sanitizeOutput = (user) => {
    const {
      password, resetPasswordToken, confirmationToken, ...sanitizedUser
    } = user; // be careful, you need to omit other private attributes yourself
    return sanitizedUser;

  plugin.controllers.user.findOne = async (ctx) => {
    const users = await strapi.entityService.findMany(
      { ...ctx.params, populate: ['rfids', 'location_users', 'locations'] }

    ctx.body = users.map(user => sanitizeOutput(user));

  return plugin;

However, when I now call the /api/users/1 endpoint (for the first user), I only get the following information:

        "id": 1,
        "username": "test.test",
        "email": "test@test.de",
        "provider": "local",
        "confirmed": true,
        "blocked": false,
        "createdAt": "2022-01-24T19:44:04.396Z",
        "updatedAt": "2022-01-24T19:45:56.352Z",
        "forename": "Test",
        "lastname": "Test",
        "street": "Teststreet",
        "no": "1",
        "zip": "12345",
        "city": "Test",
        "rfids": [
                "id": 1,
                "no": "68842493",
                "createdAt": "2022-01-24T19:47:10.691Z",
                "updatedAt": "2022-01-24T19:47:10.691Z",
                "locale": "de"
        "location_users": [
                "id": 1,
                "is_manager": true,
                "createdAt": "2022-01-24T19:46:07.667Z",
                "updatedAt": "2022-01-24T19:46:10.730Z"
                "id": 2,
                "is_manager": false,
                "createdAt": "2022-01-24T20:21:34.107Z",
                "updatedAt": "2022-01-24T20:21:34.107Z"

But the goal of the whole thing would be that I would get, for example, at location_users also still the field location with all the necessary information.

Can someone please give me a hint what I’m doing wrong here, how I might need to extend the findOne, etc.?

Thank you very much and many greetings,

Hi @thorsten
I have exactly the same problem.
Why is it possible, because of populate settings, to have findMany returning different values from findOne?
I don’t get the point.
Anyway, did you find any solution?