I have such models:
const UserSchema = new mongoose.Schema({
  name: String,
  workspaces: [
    {
      workspace: {
        type: mongoose.Schema.ObjectId,
      },
      owner: Boolean
    }
  ]
});
const WorkspaceSchema = new mongoose.Schema({
  title: String,
  description: String 
});
I want to populate the User record like this:
{
  name: "John",
  workspaces: [{
    workspace: {
      title: "First space",
      description: "About space#1"
    },
    owner: true
  }, {
    workspace: {
      title: "Second space",
      description: "About space#2"
    },
    owner: false
  }]
}
I tried to do this via populate method:
const user = await User
  .findOne(query)
  .populate({
    path: 'workspaces',
    populate: {
      path: 'workspace',
      model: 'Workspace'
    }
  });
And it's not correct. I searched for case like this, but didn't find anything similar. All another examples doesn't includes property like my boolean "owner".