You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 4.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Commands: How to compact database?

To compact a database, please use CompactDatabase command available in GlobalAdmin.

Syntax

Operation CompactDatabase(string databaseName);

Parameters
databaseName string Name of a database to compact

Example

Operation operation = store
	.DatabaseCommands
	.GlobalAdmin
	.CompactDatabase("Northwind");

operation.WaitForCompletion();

Remarks

Compacting operation is executed asynchronously and during this operation the database will be offline.