In CouchDB, how to get documents limited on value in related document? In terms of SQL, how to make WHERE on JOINed table
- by amorfis
Crossposting from [email protected]
Assume we have two kind of documents in CouchDB. Person and Car:
Person:
_id
firstname
surname
position
salary
Car:
_id
person_id
reg_number
brand
So there is one to many relationship. One person can have many cars.
I can construct map function to get every person and his/her car next to each other. In such case key is array [person.id, 0] and [car.person_id, 1].
What I can't do, is limiting this view to owners of specific brand only, e.g. if I need salaries of owners of Ferrari.