Skip to content

Instantly share code, notes, and snippets.

@ncb000gt
Created May 21, 2011 15:33
Show Gist options
  • Select an option

  • Save ncb000gt/984617 to your computer and use it in GitHub Desktop.

Select an option

Save ncb000gt/984617 to your computer and use it in GitHub Desktop.
Remove all items from a bucket in riak with riak-js.
var db = require('riak-js').getClient({port: 8091});
console.log(process.argv);
db.keys(process.argv[2], function(err, keys) {
if (err) console.log(err);
keys.forEach(function(key) {
db.remove(process.argv[2], key, function(err) {
if (err) console.log(err);
console.log("Removed: " + key);
});
});
});
@ncb000gt
Copy link
Author

Port is obviously custom and you'll get errors if you don't specify a third argument (which is the bucket name).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment