Search code examples
mongodbmongodump

mongodump "Failed: bad option: can only dump a single collection to stdout"


mongodump --out "-" 

doesn't work, it gives me this message : "Failed: bad option: can only dump a single collection to stdout". What happens ?...


Solution

  • so the exception is self-explanatory that if you use --out "-" it can show only single collection on stdout.

    So i would like to know as to what you want to achieve?

    if you want to stdout a particular collection command is :

    mongodump -o - -d <dbname> -c <collection name>
    

    if you want to take dump of whole mongodatabase ideal command is:

    mongodump --gzip --archive=db.tar