如何让 mongodump 导出 JSON 而不是 BSON
mongodump 将你的 MongoDB 数据库导出为 BSON 格式,但如果你想使用 JSON,你需要使用 mongoexport 工具。
示例:
mongoexport_examples.sh
mongoexport -d mydatabase -c mycollection # 打印到 stdout
mongoexport -d mydatabase -c mycollection -o mycollections.json # 写入 mycollections.json注意某些可以存储在 MongoDB 中的数据类型只能用 BSON 表示 - 因此在某些情况下,导出为 JSON 可能会丢失信息。
Check out similar posts by category:
Databases
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow