The current example would return albums for any artist whose name includes tom-waits; e.g. tom-waitson which is probably not what's intended.
It may not be an extremely common scenario but since the artist is already put between ":" separators in the albums' ids, it may be a good idea to restrict startkey by that separator as well?
first of all thanks for these notes; there are very helpful.
Regarding the "one to N relations" example, I suggest making a minor update or adding some description of possible side effects.
In the example provided, where
artist
is "embedded" in thealbums
ids, between ":" separators, I'd suggest using this:instead of this (note there is no ":" after the value on
startkey
)The current example would return albums for any artist whose name includes
tom-waits
; e.g.tom-waitson
which is probably not what's intended. It may not be an extremely common scenario but since the artist is already put between ":" separators in the albums' ids, it may be a good idea to restrictstartkey
by that separator as well?