DEV Community

loading...

Discussion on: Three in one (code first) : NestJs & GraphQl & Mongoose

Collapse
gastonmorixe profile image
Gaston Morixe • Edited

@Prop({ type: [Types.ObjectId], ref: Hobby.name })

Should be

@Prop({ type: [mongoose.Schema.Types.ObjectId], ref: Hobby.name })

Otherwise the references end up as strings instead of ObjectId.

Collapse
lotfi profile image
Lotfi Author

Thank you for your remark. Article updated!

Collapse
gastonmorixe profile image
Gaston Morixe

You are welcome!

Forem Open with the Forem app