Skip to content

Commit c05d3ab

Browse files
committed
part 4c
1 parent fa8514b commit c05d3ab

File tree

2 files changed

+101
-60
lines changed

2 files changed

+101
-60
lines changed

src/content/4/en/part4c.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ userSchema.plugin(uniqueValidator) // highlight-line
381381

382382
Note: when installing the _mongoose-unique-validator_ library, you may encounter the following error message:
383383

384-
![](../../images/4/uniq.png)
384+
![unresolved dependency error for mongoose unique validator](../../images/4/uniq.png)
385385

386386
The reason for this is that at the time of writing (10.11.2023) the library is not yet compatible with Mongoose version 8. If you encounter this error, you can revert to an older version of Mongoose by running the command
387387

@@ -408,7 +408,6 @@ For making new users in a production or development environment, you may send a
408408
"name": "Superuser",
409409
"password": "salainen"
410410
}
411-
412411
```
413412

414413
The list looks like this:
@@ -446,6 +445,7 @@ notesRouter.post('/', async (request, response) => {
446445
response.status(201).json(savedNote)
447446
})
448447
```
448+
449449
The note scheme will also need to change as follows in our models/note.js file:
450450

451451
```js
@@ -488,7 +488,7 @@ We can see that the user has two notes.
488488

489489
Likewise, the ids of the users who created the notes can be seen when we visit the route for fetching all notes:
490490

491-
![api/notes shows ids of numbers in JSON](../../images/4/12e.png)
491+
![api/notes shows ids of users in JSON](../../images/4/12e.png)
492492

493493
### Populate
494494

@@ -515,7 +515,7 @@ The result is almost exactly what we wanted:
515515

516516
We can use the populate parameter for choosing the fields we want to include from the documents. In addition to the field <i>id</i> we are now only interested in <i>content</i> and <i>important</i>.
517517

518-
The selection of fields is done with the Mongo [syntax](https://docs.mongodb.com/manual/tutorial/project-fields-from-query-results/#return-the-specified-fields-and-the-id-field-only):
518+
The selection of fields is done with the Mongo [syntax](https://www.mongodb.com/docs/manual/tutorial/project-fields-from-query-results/#return-the-specified-fields-and-the-_id-field-only):
519519

520520
```js
521521
usersRouter.get('/', async (request, response) => {

0 commit comments

Comments
 (0)