JKHeadley / JKHeadley/rest-hapi

Many-many association on the same model (like user_user) doesn't work

Open
#155 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.2k
Forks
155
PR merge metrics
No merged PRs in 30d

Description

The document inside the user_user collection only contains **one user field**. Should it not contain two user fields?

Steps to replicate the issue:
1. Create two users. (POST /user)
2. Add the second user as a friend of the first one. (POST /user/{firstUserId}/user) { childId: secondUserId })
3. Get the friends of the firstUser. (GET /user/{firstUserId}/user)
4. The response object is empty. No friends get returned.

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Start by reproducing the POST and GET /user/{firstUserId}/user steps, then inspect the user_user collection and the association handling. Done means the relationship stores both users and the GET response returns the added friend.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, node.js
Domain
api, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.