Run MongoDump / MongoRestore in C#

2019-08-09 23:02发布

Is there an easy way to run these commands using the C# driver? The only documentation I found involves running the EXE as a process etc, which seems a bit heavy.

The only related question I found was unanswered... am I missing something fundamental here?

http://grokbase.com/t/gg/mongodb-user/127zntq9pr/mongodump-in-c

2条回答
唯我独甜
2楼-- · 2019-08-09 23:19

mongodump and mongorestore are applications, not MongoDB commands which is why you would have to run the executable.

If interested, the C++ code for dumping a database is located here.

查看更多
贼婆χ
3楼-- · 2019-08-09 23:25

unfortunately nope. I think that easier way to do regular backup of your mongodb is to write backup script and to create task in scheduler. nice answer how to do this you can find here: MongoDB script to backup replication set locally to a Windows Server if there are simpler solutions I'll be happy to know about them -- this problem is actual for me too. :)

查看更多
登录 后发表回答