Before migrating data from a secure source server, the destination server must also be secure.
You must pass the certificate from the destination to the source server. The following steps explain how.
Perform this step only if your source RavenDB server is a secure verion 4.x (or newer) server that is running on HTTPS. For other servers, skip this step and continue to Step 2.
To import, the destination server needs to access the existing source database and fetch data from it.
To grant such access, you must first register the destination server certificate as a client certificate on your source server.
Export the destination RavenDB certificate from the DESTINATION RavenDB server.
Choose Export Server Certificates option from the Server Certificates dropdown.
Register this certificate on the SOURCE RavenDB server
Choose Upload client certificate to upload the exported certificate as the client certificate.
Upload client certificate
Set the certificate details.
Enter a name for this certificate. For future clarity, consider naming each certificate after the role that it will enable in your system (Full Stack Development, HR, Customer, Unregistered Guest, etc...)
Upload the .pfx certificate file from the destination server installation folder.
(Optional) Set a password for this certificate.
Select databases and permission levels for this certificate.
If you choose User security clearance, you can give access to specific databases on the server and configure User authorization levels for this certificate.
Click Upload to complete the process.
The uploaded certificate will be added to the list of registered client certificates on this server.
2nd Step: Access the Import View
Databases List View
On the destination RavenDB server, select a database into which the data will be imported.
Verify that this database is empty as the import will overwrite any existing content.
Go to Import Data View
Click Tasks tab.
Select Import Data.
Select From RavenDB.
3rd Step: Set the Source Server URL and database
Specify the source server URL and select the database to import the data from.
Paste URL of the server you want to import from.
The version of the server that you want to import from will show here once you enter the URL.
Enter the name of the database that you want to migrate your data from.
If any of the options is set but the source database doesn't contain any items of that type, the type will be skipped.
5th Step: Advanced Import Options
Click the Advanced button at the bottom of the options view for the following import features.
In the Studio, select database > click Task tab > select Import > select From RavenDB > click the Advanced button at the bottom > toggle Use Transform script.
Advanced Import Options - Transform Script
Use Transform Script:
// Example 1
// The script above will delete the existing change-vector from imported documents,
// New change vectors will be generated during the import.
// This is very helpful if the data is imported from a different database-group
// and you want to avoid adding old change-vector entries to a new environment.
// Example 2
this.collection = this['@metadata']['@collection'];
// This script will create a new 'collection' property in each imported document.
Customize Configuration and Ongoing Tasks
In the Studio, select database > click Task tab > select Import > select From RavenDB > click the Advanced button at the bottom > toggle Customize Configuration and Ongoing Tasks.
Advanced Import Options - Customize Configuration and Ongoing Tasks