Closed Bartas139 closed 4 months ago
Ok... wierd thing I also use
userSchema.methods.toJSON = function() { const {password, ...rest} = {...this._doc} return rest; }
And for some reason the userSchema.plugin(require('mongoose-autopopulate'))
muset be above the methods... Quite dont know why, but now it works
Hi, I have schema code like this:
And the autopopulate does not work at all. There is no error, but the findOne niether find, or findMany is not populated. I always get just the Array of roles IDs. Is there somethind wrong with my code?