修改MongoDb的 DB 和 Log 存储路径 (Windows)-摘自网络
Create a file called mongod.cfg in MongoDB folder if you dont have it. In my case: C:\Users\ivanbtrujillo\MongoDB
Then, edit mongod.cfg with notepad and add a line with the following (our custom dbpath):
dbpath=C:\Users\ivanbtrujillo\MongoDB\data\db
In this file you should especify the logpath too. My mongod.cfg file is:
logpath=C:\Users\ivanbtrujillo\MongoDB\log\mongo.log
dbpath=C:\Users\ivanbtrujillo\MongoDB\data\db
If you uses mongoDB as a windows service, you have to change this key and especify the mongod.cfg file.
To install mongodb as a windows service run this command:
**"C:\Users\ivanbtrujillo\MongoDB\bin\mongod.exe" --config "C:\Users\ivanbtrujillo\MongoDB\mongod.cfg" –install**
Open regedit.exe and go to the following route:
HKEYLOCALMACHINE\SYSTEM\CurrentControlSet\services\MongoDB
MongoDB service does not work, we have to edit the ImagePath key, delete its content and put the following:
**"C:\Users\ivanbtrujillo\MongoDB\bin\mongod.exe" --config "C:\Users\ivanbtrujillo\MongoDB\mongod.cfg"
--logpath="C:\Users\ivanbtrujillo\MongoDB\log\mongo.log" –service**
We indicates to mongo it's config file and its logpath.
Then when you init the mongodb service, it works.
Here is a full tutorial to install mongoDB in windows:http://ivanbtrujillo.herokuapp.com/2014/07/24/installing-mongodb-as-a-service-windows/
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决