I am in search of a method to dynamically chain different populate methods for various paths in a Mongoose document. The goal is to efficiently retrieve all necessary fields at once. Below is the current code snippet:
let fields = [path1, path2, ...]
let result = document.findById(id).populate(path1).populate(path2).populate(...)
Any suggestions on how to achieve this magic trick?