Skip to content

Commit ba8b56f

Browse files
Update mongo.md
1 parent 727290f commit ba8b56f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

content/techniques/mongo.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ name: string;
7575
In case you want to specify relation to another model, later for populating, you can use `@Prop()` decorator as well. For example, if `Cat` has `Owner` which is stored in a different collection called `owners`, the property should have type and ref. For example:
7676

7777
```typescript
78-
import { Schema } from 'mongoose';
78+
import * as mongoose from 'mongoose';
7979
import { Owner } from '../owners/schemas/owner.schema';
8080

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

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

8787
```typescript
88-
@Prop({ type: [{ type: Schema.Types.ObjectId, ref: Owner.name }] })
88+
@Prop({ type: [{ type: mongoose.Schema.Types.ObjectId, ref: Owner.name }] })
8989
owner: Owner[];
9090
```
9191

0 commit comments

Comments
 (0)