Fetch field of another Doc in CouchDB?

60 views Asked by At

I'm very new to CouchDB and I have a simple task that I have no been able to find a straight answer.

I have two related docs: order and invoice

invoice = {
  id: "invoice_id",
  order: "order_id",
  values: [...]
}

order = {
  id: "order_id",
  **order_number: 12345**
}

I have defined a map function that select the unfulfilled invoices, now I need the order_number, which is in the order doc. They are the same transaction. How do I fetch the order_number from the order when I get my invoices?

I've looked around and I'm getting so many answers like: view collation, linked documents, include_docs=true, structure docs to have both...

I'm just looking for the simplest way with a clear explanation. I appreciate any help.

p.s. Since I'm new I'm finding couchDB development to be very involved. I have map functions, but they need to be pushed to the couchInstance? Or I edit the map functions in Futon? Are there better ways to develop against couchDB? I see there's couchApp but the docs are sparse and the project hasn't been updated in a while.

0

There are 0 answers