From 2302d005a143073adc4baf08417bce475d600329 Mon Sep 17 00:00:00 2001 From: KiriAky 107 Date: Tue, 24 Feb 2026 13:56:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=93=BE=E6=8E=A5=E4=BA=91?= =?UTF-8?q?=E7=AB=AFMongoDB=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/readme.md | 18 +++++++++++++++++- backend/test/MongoDBConnectionTest,.py | 12 ++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 backend/test/MongoDBConnectionTest,.py diff --git a/backend/readme.md b/backend/readme.md index 1dd3e77..8739b25 100644 --- a/backend/readme.md +++ b/backend/readme.md @@ -1,4 +1,18 @@ -# 环境配置 +## 技术栈 + +| 层次 | 组件 | 说明 | +| :------- | :------------------------------------------ | :-------------------------------- | +| 前端 | Vue 3 / React + Element Plus | 文件上传、表格配置、聊天界面 | +| 后端 | FastAPI | 提供 RESTful API,异步任务调度 | +| 异步任务 | Celery + Redis | 处理耗时的解析与 AI 提取 | +| 数据库 | MongoDB(元数据、提取结果) | 存储文档块、最终结构化数据 | +| 向量检索 | faiss-cpu + 本地索引文件 | 高效相似性搜索,配合 MongoDB 使用 | +| AI 集成 | LangChain + 国内大模型 API | RAG 流水线、提示词管理 | +| 文档解析 | python-docx, pandas, markdown, 原生文件操作 | 多格式支持 | +| 部署 | Docker + Nginx + Gunicorn | 打包演示,本地或云服务器运行 | + +## 环境配置 + 部署好项目后,一般在终端都显示目前操作路径为 xx\FilesReadSystem 在终端输入: ```bash @@ -21,3 +35,5 @@ python312 -m venv venv pip install -r requirements.txt ``` 以安装项目需要的依赖包 + + diff --git a/backend/test/MongoDBConnectionTest,.py b/backend/test/MongoDBConnectionTest,.py new file mode 100644 index 0000000..e61d359 --- /dev/null +++ b/backend/test/MongoDBConnectionTest,.py @@ -0,0 +1,12 @@ +from pymongo import MongoClient + +# 连接 MongoDB(带认证) +client = MongoClient('mongodb://admin:20060825fhy.@kronecker.cc:27017/admin') + +# 切换到 test 数据库 +db = client.test + +print(db.name) + +# 正确的列出集合的方法 +print(db.list_collection_names()) \ No newline at end of file