+
+
+
+
+ Parse from clipboard
+
+
+
+
+
Host
+
{
+ if (!editingDatabase.mongodb) return;
+
+ setEditingDatabase({
+ ...editingDatabase,
+ mongodb: {
+ ...editingDatabase.mongodb,
+ host: e.target.value.trim().replace('https://', '').replace('http://', ''),
+ },
+ });
+ setIsConnectionTested(false);
+ }}
+ size="small"
+ className="max-w-[200px] grow"
+ placeholder="Enter MongoDB host"
+ />
+
+
+ {isLocalhostDb && (
+
+ )}
+
+
+
Port
+
{
+ if (!editingDatabase.mongodb || e === null) return;
+
+ setEditingDatabase({
+ ...editingDatabase,
+ mongodb: { ...editingDatabase.mongodb, port: e },
+ });
+ setIsConnectionTested(false);
+ }}
+ size="small"
+ className="max-w-[200px] grow"
+ placeholder="27017"
+ />
+
+
+
+
Username
+
{
+ if (!editingDatabase.mongodb) return;
+
+ setEditingDatabase({
+ ...editingDatabase,
+ mongodb: { ...editingDatabase.mongodb, username: e.target.value.trim() },
+ });
+ setIsConnectionTested(false);
+ }}
+ size="small"
+ className="max-w-[200px] grow"
+ placeholder="Enter MongoDB username"
+ />
+
+
+
+
Password
+
{
+ if (!editingDatabase.mongodb) return;
+
+ setEditingDatabase({
+ ...editingDatabase,
+ mongodb: { ...editingDatabase.mongodb, password: e.target.value.trim() },
+ });
+ setIsConnectionTested(false);
+ }}
+ size="small"
+ className="max-w-[200px] grow"
+ placeholder="Enter MongoDB password"
+ autoComplete="off"
+ data-1p-ignore
+ data-lpignore="true"
+ data-form-type="other"
+ />
+
+
+ {isShowDbName && (
+
+
DB name
+
{
+ if (!editingDatabase.mongodb) return;
+
+ setEditingDatabase({
+ ...editingDatabase,
+ mongodb: { ...editingDatabase.mongodb, database: e.target.value.trim() },
+ });
+ setIsConnectionTested(false);
+ }}
+ size="small"
+ className="max-w-[200px] grow"
+ placeholder="Enter MongoDB database name"
+ />
+
+ )}
+
+
+
Use TLS
+
{
+ if (!editingDatabase.mongodb) return;
+
+ setEditingDatabase({
+ ...editingDatabase,
+ mongodb: { ...editingDatabase.mongodb, useTls: checked },
+ });
+ setIsConnectionTested(false);
+ }}
+ size="small"
+ />
+
+
+
+
setShowAdvanced(!isShowAdvanced)}
+ >
+ Advanced settings
+
+ {isShowAdvanced ? (
+
+ ) : (
+
+ )}
+
+
+
+ {isShowAdvanced && (
+
+
Auth database
+
{
+ if (!editingDatabase.mongodb) return;
+
+ setEditingDatabase({
+ ...editingDatabase,
+ mongodb: { ...editingDatabase.mongodb, authDatabase: e.target.value.trim() },
+ });
+ setIsConnectionTested(false);
+ }}
+ size="small"
+ className="max-w-[200px] grow"
+ placeholder="admin"
+ />
+
+ )}
+
+
+ {isShowCancelButton && (
+
+ )}
+
+ {isShowBackButton && (
+
+ )}
+
+ {!isConnectionTested && (
+
+ )}
+
+ {isConnectionTested && (
+
+ )}
+
+
+ {isConnectionFailed && (
+
+ If your database uses IP whitelist, make sure Postgresus server IP is added to the allowed
+ list.
+
+ )}
+
+ );
+};
diff --git a/frontend/src/features/restores/ui/RestoresComponent.tsx b/frontend/src/features/restores/ui/RestoresComponent.tsx
index 18b8cb9..ced37ce 100644
--- a/frontend/src/features/restores/ui/RestoresComponent.tsx
+++ b/frontend/src/features/restores/ui/RestoresComponent.tsx
@@ -38,6 +38,7 @@ const createInitialEditingDatabase = (database: Database): Database => ({
postgresql: clearCredentials(database.postgresql),
mysql: clearCredentials(database.mysql),
mariadb: clearCredentials(database.mariadb),
+ mongodb: clearCredentials(database.mongodb),
});
const getRestorePayload = (database: Database, editingDatabase: Database) => {
@@ -48,6 +49,8 @@ const getRestorePayload = (database: Database, editingDatabase: Database) => {
return { mysql: editingDatabase.mysql };
case DatabaseType.MARIADB:
return { mariadb: editingDatabase.mariadb };
+ case DatabaseType.MONGODB:
+ return { mongodb: editingDatabase.mongodb };
default:
return {};
}