Skip to content

Commit 09d6705

Browse files
authored
Merge pull request #3064 from 1b7/source-1
Part 4c: Altered possibly misleading noteSchema `user` field type changes.
2 parents 049a962 + fdb0a23 commit 09d6705

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/content/4/en/part4c.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,16 @@ The note scheme will also need to change as follows in our models/note.js file:
442442
const noteSchema = new mongoose.Schema({
443443
content: {
444444
type: String,
445-
minLength: 5,
446445
required: true,
446+
minlength: 5
447447
},
448448
important: Boolean,
449-
user: String, //highlight-line
449+
// highlight-start
450+
user: {
451+
type: mongoose.Schema.Types.ObjectId,
452+
ref: 'User'
453+
}
454+
//highlight-end
450455
})
451456
```
452457

0 commit comments

Comments
 (0)