[SERVER-7860] mongodump do not work properly in "print to stdout" mode Created: 06/Dec/12  Updated: 09/Jul/16  Resolved: 08/Dec/12

Status: Closed
Project: Core Server
Component/s: Tools
Affects Version/s: 2.2.0
Fix Version/s: None

Type: Bug Priority: Trivial - P5
Reporter: Denis Bozhok Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

logger-01 ~ # uname -a
Linux logger-01 3.3.8-gentoo #5 SMP Fri Aug 3 11:30:37 MSK 2012 x86_64 Intel(R) Xeon(R) CPU X5650 @ 2.67GHz GenuineIntel GNU/Linux


Operating System: ALL
Steps To Reproduce:

execute mongodump --host localhost -d <dbname> -o -

Participants:

 Description   

when trying to dump the database to the specified dir, it seems ok:
logger-01 ~ # mongodump --host localhost -d logger -o tmp
connected to: localhost
Thu Dec 6 13:31:54 DATABASE: logger to tmp/logger
Thu Dec 6 13:31:54 logger.xxxxx to tmp/logger/xxxxx.bson
Thu Dec 6 13:31:54 doing snapshot query
Thu Dec 6 13:31:54 2 objects
Thu Dec 6 13:31:54 Metadata for logger.xxxxx to tmp/logger/xxxxx.metadata.json
Thu Dec 6 13:31:54 logger.SoapTradeApi to tmp/logger/SoapTradeApi.bson
Thu Dec 6 13:31:54 doing snapshot query
Thu Dec 6 13:31:57 899600/2592468 34% (objects)
^C

when trying to do the same, but to the stdout:
logger-01 ~ # mongodump --host localhost -d logger -o -
connected to: localhost
Thu Dec 6 13:31:17 You must specify database and collection to print to stdout

it`s verys usable to send output to the gzip or other compressor and compress the data 'on the fly' with out huge disk usage.



 Comments   
Comment by Vasyl Khrystiuk [ 08/Nov/13 ]

but there must be another way to dump all collections from db to one *.tar file

Comment by Daniel Pasette (Inactive) [ 11/Dec/12 ]

because mongodump does the logic you've described for you and outputs each collection to a separate file.

Comment by Denis Bozhok [ 11/Dec/12 ]

So, if I need to dump all databases with all collections inside, firstly I have to take a list of all databases and collections and then pass it to the mongodump?
But there is no need to specify collection when dumping to the disk. Why?

Comment by Daniel Pasette (Inactive) [ 10/Dec/12 ]

You will have to script this on the client side.

Comment by Denis Bozhok [ 10/Dec/12 ]

Thanks for your reply.
But what if I want to dump all collections to the stdout?

Comment by Daniel Pasette (Inactive) [ 08/Dec/12 ]

As the error message says, you need to specify a collection when using mongodump with stdout. There is no binary delimiter between different collections.

We'll add a note to the mongodump documentation

Generated at Thu Feb 08 03:15:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.