couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lenin <lening...@gmail.com>
Subject How to fetch particular data from document in couchdb using jquery
Date Tue, 11 Sep 2012 05:13:07 GMT
How to get particular data from document 

Example in sql 

SELECT * FROM TABLE WHERE ID='101' 


i have created map function in couchDB(Futon) : 


function(doc,val) { 
  if(doc.amount=='1') {   // here instead of '1' i  can use variable val(2nd
argument of the fun) 
    emit(doc.amount, doc.name); 
  } 
}

my jquery code is : 

*
 $(document).ready(function() { 
var db = $.couch.db(window.location.pathname.split("/")[1]); 
$("#dataview").empty(); 
db.view("myDesign/myView", { 
success: function(data){ 
data.rows.map(function(row) {
 / //my printing logic goes here
 // here i can able to get all the data irrespectively. 
// which condition i need add to get specified record. 
// how to use above function using jquery/ 
}); }, 
error: function(req, textStatus, errorThrown){
alert('Error '+ textStatus);} 
});
 }); 
*

Explain the code to write using Jquery. 
Here am using jquery.couch.js, jquery.js 

Thanks in advance..... 

Regards 
G.Lenin 



--
View this message in context: http://couchdb-development.1959287.n2.nabble.com/How-to-fetch-particular-data-from-document-in-couchdb-using-jquery-tp7580890.html
Sent from the CouchDB Development mailing list archive at Nabble.com.

Mime
View raw message