I have seen this https://www.couchbase.com/forums/t/join-three-documents/31166 which I hoped would solve my issue but it didn’t. Basically, I expect only two documents but I am getting a dozen. Here are my document types:
{type:'parent', parentId: 1, parentName: 'parent name1'}
{type:'parent', parentId: 2, parentName: 'parent name2'}
{type:'child', parentId: 1, childName: ' Child 1'}
{type:'child', parentId: 2, childName: ' Child 2'}
{type:'player', parentId: 1, childId: 1, playerId: 10}
{type:'player', parentId: 1, childId: 2, playerId: 10}
basically, player documents select a parent and a child to create their own parent-child relationship. So in the above, player with id 10 has chosen to create a family with children 1 and 2 and parent id 1. Now I want to return the family for playerId 10 which should be two documents as follows:
{type:'player', parentId: 1, childId: 2, playerId: 10, parentName: 'parent name 1', childName: 'child name 2'},
{type:'player', parentId: 1, childId: 1, playerId: 10, parentName: 'parent name 1', childName: 'child name 1'}
the join statement from the above link gives me about 12 records when in reality it should return two documents for player id 10.
What would the join statements look like please?