Hello, I don’t understand why the user_name is of type <int>
in the reviews subdocument of items. Should it be <objectId>
- thus referencing the specific user that wrote the review? I am imagining an access pattern where I seek to list all reviews for a given user. I suppose if the user_name where of type <string>
I could find all a users reviews but I haven’t tied to model that query yet
Hey @Dwight_Ford1,
Welcome to the MongoDB Community Forums!
Correct, thanks for pointing this out! Relationship between user and reviews is
one to many
, so there should be a user_id (ObjectId)
and user_name(string)
. Int
type doesn’t seem useful in this case.
Feel free to reach out for anything else as well.
Regards,
Satyam
2 Likes
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.