In CouchDB, how to get documents limited on value in related document? In terms of SQL, how to make WHERE on JOINed table
Posted
by
amorfis
on Stack Overflow
See other posts from Stack Overflow
or by amorfis
Published on 2009-12-12T17:41:37Z
Indexed on
2011/03/10
16:10 UTC
Read the original article
Hit count: 244
couchdb
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.
© Stack Overflow or respective owner