I have Node.js app, served by express, I got two different mongoose schema userModel and postMode, with my frontend being made with React.js. I'm creating a component that will create and display posts. Display post will contain username, avatar, date, text, and images. The problem is the avatar is in the userModel. Is there a way that I can also display the avatar from another schema? I'm thinking that I will compare the two schema based on if they have the same key value because both of them have username. To display the post I send Axios to get request based on the postModel.
Backend
export const getUserRelatedPost = asyncHandler(async (req, res) => {
const postData = await postModel.find({});
res.json(postData);
});
userModel
Thanks!