Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You got some great answers here already.</p> <p>From the nano source code you have an example that might help:</p> <ul> <li><a href="https://github.com/dscape/nano/blob/master/examples/bulk_transform.js" rel="nofollow">https://github.com/dscape/nano/blob/master/examples/bulk_transform.js</a></li> </ul> <p>Also if you don't really understand how nodejs flow control works I can't recommend enough that you see this tutorial:</p> <ul> <li><a href="http://nodetuts.com/tutorials/19-asynchronous-iteration-patterns.html#video" rel="nofollow">http://nodetuts.com/tutorials/19-asynchronous-iteration-patterns.html#video</a></li> </ul> <p>Better than using a tool is to use the tool understanding how it works :) Maybe you'll end up just coding your own control flow, that's what most of us ends up doing anyway.</p> <p>Hope this helps, attached code for convenience.</p> <pre><code> var db = require('nano')('http://localhost:5984/emails') , async = require('async') ; function update_row(row,cb) { var doc = row.doc; delete doc.subject; db.insert(doc, doc._id, function (err, data) { if(err) { console.log('err at ' + doc._id); cb(err); } else { console.log('updated ' + doc._id); cb(); } }); } function list(offset) { var ended = false; offset = offset || 0; db.list({include_docs: true, limit: 10, skip: offset}, function(err, data) { var total, offset, rows; if(err) { console.log('fuuuu: ' + err.message); rows = []; return; } total = data.total_rows; offset = data.offset; rows = data.rows; if(offset === total) { ended = true; return; } async.forEach(rows, update_row, function (err) { if(err) { console.log('something failed, check logs'); } if(ended) { return; } list(offset+10); }); }); } list(); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload