francescov1 / mongoose-tsgen

A plug-n-play Typescript generator for Mongoose.
102 stars 24 forks source link

TypeError: val.ref.replace is not function #84

Closed matthijssm closed 2 years ago

matthijssm commented 2 years ago

Hi, while running the script it fails on this TypeError. Do you have an idea where this issue might come from?

I'm running this lib on the latest version 9.0.0 with mongoose 6.2.1

TypeError: val.ref.replace is not  a function
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
matthijssm commented 2 years ago

Nevermind found the problem. I was using a model as a ref instead of a string. It was band: { type: Types.ObjectId, ref: Band}, but it should be band: { type: Types.ObjectId, ref: Band.modelName },

francescov1 commented 2 years ago

Awesome great to hear! Anything that could've made debugging easier?