diff --git a/content/techniques/mongo.md b/content/techniques/mongo.md index cd08d6e711..f01e360671 100644 --- a/content/techniques/mongo.md +++ b/content/techniques/mongo.md @@ -85,14 +85,14 @@ owner: Owner; In case there are multiple owners, your property configuration should look as follows: ```typescript -@Prop({ type: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Owner' }] }) +@Prop({ type: [{ type: mongoose.Schema.Types.ObjectId }], ref: 'Owner' }) owners: Owner[]; ``` If you don’t intend to always populate a reference to another collection, consider using `mongoose.Types.ObjectId` as the type instead: ```typescript -@Prop({ type: { type: mongoose.Schema.Types.ObjectId, ref: 'Owner' } }) +@Prop({ type: mongoose.Schema.Types.ObjectId, ref: 'Owner' }) // This ensures the field is not confused with a populated reference owner: mongoose.Types.ObjectId; ```