Where is in couchdb the contact person associated with a user?

Hi all,
Looking to users’ docs I can see the facility_id key containing the place associated with a user, but what about the person associated with the user ? where is this association between user and contact(person) stored ?

There’s a user-settings doc under the medic database with the same id as the user docs. That would contain the association between user and contact.

2 Likes

Here’s a SQL snippet that might be helpful.

SELECT
	doc->>'_id' AS uuid,
	doc->>'name' AS name,
	doc->>'roles' AS roles,
	doc->>'contact_id' AS contact_id,
	doc->>'facility_id' AS facility_id,
	doc->>'known' AS known,
	doc->>'phone' AS phone,
	doc->>'language' AS language,
	jsonb_pretty(doc)
	
FROM
	couchdb
	
WHERE
	doc->>'type' = 'user-settings'