如何在mongodb上导入.bson文件格式 [英] How to Import .bson file format on mongodb

查看:3017
本文介绍了如何在mongodb上导入.bson文件格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用mongodump命令在服务器上导出了数据库,转储存储在.bson文件中.我需要使用mongorestore命令将其导入到本地服务器中.但是,它不起作用.什么是正确的mongorestore命令,其他的tools to restore db是什么?

I've exported the database on the server using mongodump command and dump is stored in .bson file. I need to import that in my local server using mongorestore command. However it's not working. What is the correct mongorestore command and what are the other tools to restore db?

推荐答案

导入 .bson 文件非常简单:

mongorestore -d db_name -c collection_name /path/file.bson

仅针对单个收藏夹为例.尝试以下操作:

Incase only for a single collection.Try this:

mongorestore --drop -d db_name -c collection_name /path/file.bson

用于还原mongodump导出的完整文件夹:

For restoring the complete folder exported by mongodump:

mongorestore -d db_name /path/

这篇关于如何在mongodb上导入.bson文件格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆