Having two collections in my MongoDB structured as follows:
Data
User:
id: ObjectId ("5fb39e3d11eaad3e30cfb1b0")
userName: "Tobias"
password: "yyy"
id: ObjectId ("5fb3c83fb774ff3340482250")
userName: "Thor"
password: "xxx"
Courses:
id: ObjectId ("5fb3cf3da8227e101826e2db")
CourseName: "Design"
userId: "5fb39e3d11eaad3e30cfb1b0" (THIS IS THE SAME AS THE OBJECT ID FOR THE FIRST USER)
When a user logs in, they can add a course which then gets added to the MongoDB collection along with the coursename.
I'm trying to figure out how to display only the courses that match the currently logged in user. My tech stack includes Mongoose for user-login, Express for server connection, EJS for view, and VueJS for control.
Coming from relational databases, I'm unsure if my approach of joining objectIDs is a good practice or not.