Skip to content

Instantly share code, notes, and snippets.

@aindong
Created November 5, 2014 00:14
Show Gist options
  • Save aindong/5cdb87ea857c791174c1 to your computer and use it in GitHub Desktop.
Save aindong/5cdb87ea857c791174c1 to your computer and use it in GitHub Desktop.
$.ajax({
url: 'http://127.0.0.1:5984/insightout/_all_docs?include_docs=true&limit=25',
type: 'GET',
success: function(result) {
var result = JSON.parse(result);
for(var i = 0; i<result.rows.length; i++) {
if(result.rows[i].doc.type == 'DeviceReading') {
//console.log(result.rows[i].doc._id)
$.ajax({
url: 'http://127.0.0.1:5984/insightout/_design/update_readings/_update/in-place-query/' + result.rows[i].doc._id + '?field=couchDbId&value=19fc40f327d2a154a1c6288089cb7579',
type: 'PUT',
success: function(mes) {
console.log(mes);
}
});
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment