diff --git a/src/content/4/en/part4c.md b/src/content/4/en/part4c.md index 8eae9205eb..1b90775e30 100644 --- a/src/content/4/en/part4c.md +++ b/src/content/4/en/part4c.md @@ -169,7 +169,7 @@ The ids of the notes are stored within the user document as an array of Mongo id } ``` -The type of the field is ObjectId that references note-style documents. Mongo does not inherently know that this is a field that references notes, the syntax is purely related to and defined by Mongoose. +The type of the field is ObjectId that references note-style documents. Mongo does not inherently know that this is a field that references notes, the syntax is purely related to and defined by Mongoose. The ref field suggests the name of the model that will be referred to. Let's expand the schema of the note defined in the models/note.js file so that the note contains information about the user who created it: @@ -491,7 +491,7 @@ usersRouter.get('/', async (request, response) => { }) ``` -The [populate](http://mongoosejs.com/docs/populate.html) method is chained after the find method making the initial query. The argument given to the populate method defines that the ids referencing note objects in the notes field of the user document will be replaced by the referenced note documents. +The [populate](http://mongoosejs.com/docs/populate.html) method is chained after the find method making the initial query. The argument given to the populate method defines that the ids referencing note objects in the notes field of the user document will be replaced by the referenced note documents. Mongoose first queries the users collection for the list of users, and then queries the collection corresponding to the model object specified by the ref property in the users schema for data with the given object id. The result is almost exactly what we wanted: