Skip to content

Instantly share code, notes, and snippets.

@korczis
Created May 23, 2014 22:17
Show Gist options
  • Save korczis/c3f7e5c38078c1b91538 to your computer and use it in GitHub Desktop.
Save korczis/c3f7e5c38078c1b91538 to your computer and use it in GitHub Desktop.
Microcrawler CouchDB storage backend
var dbName = 'apollo-web-gui';
var nano = require('nano')('http://localhost:5985');
nano.db.create(dbName);
var db = nano.db.use(dbName);
// Register on data event handler
engine.on('data', function (result) {
logger.info('DATA: ' + JSON.stringify(result, null, 4));
db.insert(result, null, function(err, body, header) {
if (err) {
console.log(err.message);
return;
}
});
// Increment results counter
resultsCount++;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment