Fix(curriculum): external mongoose links in backend development (#46413)
* remove the link * added an news article * removed the instruction link * added mongoose article * added _blank * added _blank * to not increase the other issue load part 1 * not increase the other issue load part 2pull/46445/head
parent
0b20407fe3
commit
893c445c49
|
@ -38,7 +38,7 @@ age : number
|
|||
favoriteFoods : array of strings (*)
|
||||
```
|
||||
|
||||
Use the Mongoose basic schema types. If you want you can also add more fields, use simple validators like required or unique, and set default values. See the [Mongoose docs](http://mongoosejs.com/docs/guide.html).
|
||||
Use the Mongoose basic schema types. If you want you can also add more fields, use simple validators like required or unique, and set default values. See our <a href="https://www.freecodecamp.org/news/introduction-to-mongoose-for-mongodb-d2a7aa593c57/" target="_blank" rel="noopener noreferrer nofollow">Mongoose article</a>.
|
||||
|
||||
Now, create a model called `Person` from the `personSchema`.
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ In the good old days, this was what you needed to do if you wanted to edit a doc
|
|||
|
||||
Modify the `findEditThenSave` function to find a person by `_id` (use any of the above methods) with the parameter `personId` as search key. Add `"hamburger"` to the list of the person's `favoriteFoods` (you can use `Array.push()`). Then - inside the find callback - `save()` the updated `Person`.
|
||||
|
||||
**Note:** This may be tricky, if in your Schema, you declared `favoriteFoods` as an Array, without specifying the type (i.e. `[String]`). In that case, `favoriteFoods` defaults to Mixed type, and you have to manually mark it as edited using `document.markModified('edited-field')`. See [Mongoose documentation](https://mongoosejs.com/docs/schematypes.html#Mixed)
|
||||
**Note:** This may be tricky, if in your Schema, you declared `favoriteFoods` as an Array, without specifying the type (i.e. `[String]`). In that case, `favoriteFoods` defaults to Mixed type, and you have to manually mark it as edited using `document.markModified('edited-field')`. See our <a href="https://www.freecodecamp.org/news/introduction-to-mongoose-for-mongodb-d2a7aa593c57/" target="_blank" rel="noopener noreferrer nofollow">Mongoose article</a>.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
|
Loading…
Reference in New Issue