Mongodb的"mongodump"命令,JavaScript执行错误 [英] Mongodb's "mongodump" command, javascript execution error

查看:665
本文介绍了Mongodb的"mongodump"命令,JavaScript执行错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许我对mongodump应该如何工作有完全的误解,但是除了返回JavaScript execution failed: SyntaxError: Unexpected identifier错误之外,我似乎无法让它做任何事情.

Perhaps I have a complete misunderstanding of how mongodump is supposed to work, but I can't seem to get it to do anything besides returning a JavaScript execution failed: SyntaxError: Unexpected identifier error.

这是我在做什么:

  • Mongod正在运行
  • 我要备份一个名为"mydb"的数据库
  • 我在mongo shell里面
  • 我尝试了命令mongodump --db mydb并收到上述错误
  • 我已经尝试过mongodumpmongoexport,它们都有相同的问题
  • Mongod is running
  • I want to backup a database called "mydb"
  • I'm inside the mongo shell
  • I tried the command mongodump --db mydb and get the above error
  • I've tried both mongodump and mongoexport, both have the same issue

我在做什么错了?

推荐答案

尝试以下操作,它将工作

i.打开终端

ii.输入mongodump --collection集合名--db dbname(不要进入mongo shell);

ii. Enter mongodump --collection collectionname --db dbname (Don't go inside mongo shell);

iii.如果默认端口不同(不是27017),请执行以下命令

iii.If default port is different(other than 27017) then go for the following command

   mongodump --host mongodb1.example.net --port 37017 --username user --password pass    --out /opt/backup/mongodump-2011-10-24

这篇关于Mongodb的"mongodump"命令,JavaScript执行错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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