As per the requirement, a post should only have maximum one user. The user field in Post schema shouldn't be an array.
I can tell from data modelling that you are planning to store User and Post in two models/collections. But when a post gets created, you only save userId in Post, without storing postId back to User.
The userId in Post collection is stored as String instead of ObjectId.
Please make a branch to fix whatever mentioned in this issue.
user
field inPost
schema shouldn't be an array.User
andPost
in two models/collections. But when a post gets created, you only saveuserId
inPost
, without storingpostId
back toUser
.userId
inPost
collection is stored asString
instead ofObjectId
.Please make a branch to fix whatever mentioned in this issue.