Skip to content

Instantly share code, notes, and snippets.

@zdzolton
Created August 9, 2010 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zdzolton/515461 to your computer and use it in GitHub Desktop.
Save zdzolton/515461 to your computer and use it in GitHub Desktop.
CouchDB - commit all databases
<!DOCTYPE html>
<html>
<head><title>Commit All Databases</title></head>
<body>
<h1>Commit All Databases</h1>
<p>This script will trigger <tt>_ensure_full_commit</tt> on all databases.</p>
<ul id="databases"></ul>
</body>
<script src="/_utils/script/jquery.js"></script>
<script src="/_utils/script/jquery.couch.js"></script>
<script>
$.couch.allDbs({
success : function(dbs) {
dbs.forEach(function(db) {
$.ajax({
type: "POST", url: "/" + encodeURIComponent(db) + "/_ensure_full_commit",
contentType: "application/json", dataType: "json",
complete : function(r) {
if (r.status == 201) {
$("#databases").append('<li>committed: '+db+'</li>');
} else {
$("#databases").append('<li style="color:red;">error: '+db+'</li>');
}
}
});
});
}
});
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment