gpt4 book ai didi

mongodb - mongodump 与 mongoexport : which is better?

转载 作者:行者123 更新时间:2023-12-03 16:48:05 25 4
gpt4 key购买 nike

我想导出非常大的集合并将它们导入到另一台服务器的另一个数据库中。我发现至少有两种方法: mongoexport mongodump .
我搜索了之前关于这个问题的帖子,但是我没有找到关于 的完整比较/基准。速度导出和尺寸 使用这两种方式导出文件!
如果有任何经验可以分享,我将不胜感激。

最佳答案

如最新 documentation 中所述

Avoid using mongoimport and mongoexport for full instance production backups. They do not reliably preserve all rich BSON data types, because JSON can only represent a subset of the types supported by BSON. Use mongodump and mongorestore as described in MongoDB Backup Methods for this kind of functionality.


由于您需要恢复大量数据,因此首选转储。

mongoexport is a command-line tool that produces a JSON or CSV export of data stored in a MongoDB instance.


mongodump is a utility for creating a binary export of the contents of a database. mongodump can export data from either mongod or mongos instances; i.e. can export data from standalone, replica set, and sharded cluster deployments.

关于mongodb - mongodump 与 mongoexport : which is better?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63719882/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com