juampi92 / adonis-mongoose-model

Mongoose models for Adonis framework.
MIT License
61 stars 17 forks source link

Schema hasn't been registered for model #61

Open mayconsilvaa opened 4 years ago

mayconsilvaa commented 4 years ago

Hi! Good morning.

I am getting the following error when working with ref.

Schema hasn't been registered for model "User". Use mongoose.model(name, schema)

--

const { ObjectId } = use('mongoose').Schema.Types

leaderId: { type: ObjectId, ref: 'User', required: true, }

Thank you to help!