MERN Stack & GraphQL - #15 Query Population

Published: 25 January 2019
on channel: Code Realm
7,425
134

When designing relationships, we typically link documents via ObjectId, rather than embedding entire objects. However, when consuming the API, we construct nested queries and expect GraphQL to connect any related models behind the scenes. The mapping from ObjectId reference to the underlying Mongoose model is something that needs to be orchestrated in resolvers, since the default behavior of returning the parent fields would not suffice. We are going to take a closer look at those today.

Besides, we will also revisit validation briefly. With this video, we should be able to initiate chats in the app. Next up, we will work on sending messages. There are a few spots in GraphQL where we left out user privacy. Did you spot those? We'll address them in the upcoming episode.

Mongoose Populate https://mongoosejs.com/docs/populate....

Populate with Promises https://github.com/Automattic/mongoos...


Watch video MERN Stack & GraphQL - #15 Query Population online without registration, duration hours minute second in high quality. This video was added by user Code Realm 25 January 2019, don't forget to share it with your friends and acquaintances, it has been viewed on our site 7,42 once and liked it 13 people.