Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query naming clash in 'One to N Relations' #58

Open
h4cc opened this issue Jul 10, 2015 · 2 comments
Open

Query naming clash in 'One to N Relations' #58

h4cc opened this issue Jul 10, 2015 · 2 comments

Comments

@h4cc
Copy link

h4cc commented Jul 10, 2015

I implemented 1-n relations and got the following problem.
In the section https://github.com/eHealthAfrica/couchdb-best-practices#one-to-n-relations the example looks like this:

"_id": "artist:tom-waits:album:closing-time",

When using a query to fetch all artists, also the album relations will be fetched:

/_all_docs?startkey="artist:"&endkey="artist:\ufff"

In the section 'N to N Relations', the example does not have that problem because a own namespace friendship: has been used:

"_id": "friendship:person:avery-mcdonalid:with:person:troy-howell",

Would it be better to have a own namespace for the 'One to N Relations' too?

@fer-ri
Copy link

fer-ri commented Oct 25, 2018

Any solution for this? or we need to change the structure of _id?

@MarcMcIntosh
Copy link

a colon ":" is \u003A,
in the querry switching \uffff for \u0034 would exclude some characters.
Can \uffff of \uff0 be used as separator tnsead of a colon?
so the _id would look like
"_id": "friendship\ufffperson\ufffavery-mcdonalid\ufffwith\ufffperson\uffftroy-howell"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants