javascript - Join two different documents in couchdb using futon map program? -
I like the two documents:
{ "_ id": "00315fd5428d43a19ce86ae7a273085f "" _rev ":" 3-03le6l3837bf7e9c75f8bc9f5230d92l "," Device_sno ":" WEC343 "," Moving_status ": true," Overall_status ": true," C "," -1 ° C "," Trip_id ": 3 } { "_ id": "1a", "_rev": "4-e876b14dcb4cfd18aba8eb36b2be33bd", "customer_name": "Praneeth", "CUSTOMER_ID": 2, "tripp_id": 3} < P> Now on the basis of the first travel ID in the document, I want to get the customer's name from doc2. Can anyone help me fix this, it will help me a lot ..........
You have to throw an object value which is. The main / value added throwing process was processed with {'_ id': XXX} then insert_docs = will replace the document with ID XXX instead of true document.
It means that if a document is an id of other documents, it can be created near the same key to be given to keep those documents in mind,
{...., {"trip_id": "ID of the document to be brought out"}}Then you can define a view like
function (doctor) {emit (doc.key, {"_ id": doc.trip_id}); // doc.key is the key on which you want to sort your view. }Now you do
as can http query: // localhost: 5984 / Db_name / _design / Ddoc_name / _view / VIEW_NAME Key = "Some-valued" & amp; Include_docs = trueThis will bring the linked document. Note the important thing is that emissions should point to the second parameter document in which you want to receive should point to
trip_id_idin your case .
Comments
Post a Comment