From 9e1097af39a4367f50b97d9e94bf536bd38244ca Mon Sep 17 00:00:00 2001 From: Asmar Date: Tue, 16 Sep 2025 16:12:59 +0300 Subject: [PATCH] docs(mongo): pass ref in PropOptions root --- content/techniques/mongo.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; ```