Add MongoDB integration and documentation updates

- Enhanced MongoDB connection handling in backend with improved host validation.
- Updated documentation to include MongoDB connection options and API references.
- Added new images for MongoDB connection forms and processes.
- Implemented MongoDB connection form in the frontend with necessary adjustments.
This commit is contained in:
Victor Santos
2025-11-17 17:39:37 -03:00
parent 055a663d24
commit ed475f0ed8
9 changed files with 166 additions and 12 deletions
@@ -17,11 +17,19 @@ export const getMongoDBConnectionListItem = () => {
};
export const validateMongoDBConnectionCredentials = async (config: TMongoDBConnectionConfig) => {
const [hostIp] = await verifyHostInputValidity(config.credentials.host);
let normalizedHost = config.credentials.host.trim();
const isSrvFromHost = normalizedHost.startsWith("mongodb+srv://");
if (isSrvFromHost) {
normalizedHost = normalizedHost.replace(/^mongodb\+srv:\/\//, "");
} else if (normalizedHost.startsWith("mongodb://")) {
normalizedHost = normalizedHost.replace(/^mongodb:\/\//, "");
}
const [hostIp] = await verifyHostInputValidity(normalizedHost);
let client: MongoClient | null = null;
try {
const isSrv = !config.credentials.port;
const isSrv = !config.credentials.port || isSrvFromHost;
const uri = isSrv ? `mongodb+srv://${hostIp}` : `mongodb://${hostIp}:${config.credentials.port}`;
const clientOptions: {