Skip to content

Commit 3e77ca4

Browse files
Update mongo.md
1 parent 1490ed6 commit 3e77ca4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

content/techniques/mongo.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ In case you want to specify relation to another model, later for populating, you
7777
import * as mongoose from 'mongoose';
7878
import { Owner } from '../owners/schemas/owner.schema';
7979

80-
@Prop({ type: mongoose.Schema.Types.ObjectId, ref: Owner.name })
80+
@Prop({ type: mongoose.Schema.Types.ObjectId, ref: 'Owner' })
8181
owner: Owner;
8282
```
8383

8484
In case there are multiple owners, your property configuration should look as follows:
8585

8686
```typescript
87-
@Prop({ type: [{ type: mongoose.Schema.Types.ObjectId, ref: Owner.name }] })
87+
@Prop({ type: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Owner' }] })
8888
owner: Owner[];
8989
```
9090

0 commit comments

Comments
 (0)