gpt4 book ai didi

json - 将数据库从 MongoDb atlas 导出到本地机器 Mongo Compass

转载 作者:行者123 更新时间:2023-12-03 18:14:03 28 4
gpt4 key购买 nike

我在 Atlas 中有名为“test”的远程数据库,我想将集合名称 image_table 作为 JSON 文件下载。

在mac终端中:

$ mongoexport –db test –collection image_table image.json
我收到错误>

020-01-16T13:49:12.822+0100 解析命令行选项时出错:位置参数太多:[–db test –collection image_table image.json]
2020-01-16T13:49:12.822+0100 尝试“mongoexport --help”以获取更多信息

最佳答案

MongoDB Compass 有很多缺陷,即使执行导出集合这样的微不足道的任务,您也可能会失败。例如。它将跳过导出中的某些字段。应用程序本身说:“显示的字段来自集合中文档的 样本 ......”。根据我的经验,Compass 使用的示例非常小。即使导出 100 个左右的文档,我也丢失了数据。
使用mongoexport很容易。如果您使用 mongo 3.6+,这将起作用:mongoexport --uri mongodb+srv://<username>@atlas-cluster-url.mongodb.net/<db-name> --collection <collection-name> --out <path-to-export>

关于json - 将数据库从 MongoDb atlas 导出到本地机器 Mongo Compass,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59770288/

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