[SERVER-7721] Regression of "mongodump --collection" Usage from 2.0.x to 2.2.x Created: 20/Nov/12  Updated: 03/May/17  Resolved: 27/Dec/12

Status: Closed
Project: Core Server
Component/s: Tools
Affects Version/s: 2.2.1
Fix Version/s: 2.3.2

Type: Bug Priority: Major - P3
Reporter: Daniel Pasette (Inactive) Assignee: Daniel Pasette (Inactive)
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Documented
is documented by DOCS-9026 Regression of "mongodump --collection... Closed
Related
Backwards Compatibility: Major Change
Operating System: ALL
Steps To Reproduce:
  1. Create a v2.0.8 mongod standalone instance
  2. Populate two databases with the same collection name.
  3. mongodump v2.0.8 and mongodump v2.2.1.
Participants:

 Description   

Using mongo v2.0.8, I created two collections, a.counter and b.counter, and then ran mongodump v2.0.8 w/o specifying a database. The observed behavior is mongodump iterating through all databases and looks for the "counter" collection.

/tmp> /opt/mongodb-osx-x86_64-2.0.8/bin/mongodump --port 12345 -c counter
connected to: 127.0.0.1:12345
all dbs
DATABASE: a	 to 	dump/a
	a.counter to dump/a/counter.bson
		 1000 objects
DATABASE: b	 to 	dump/b
	b.counter to dump/b/counter.bson
		 1000 objects
DATABASE: *	 to 	dump/*

mongodump v2.2.1 results in:

/tmp> /opt/mongodb-osx-x86_64-2.2.1/bin/mongodump --port 12345 -c counter
connected to: 127.0.0.1:12345
Tue Nov 20 10:25:16 all dbs
assertion: 13106 nextSafe(): { $err: "db name can't be empty", code: 13075 }

This seems like a regression, or at minimum, an undocumented change in behavior.



 Comments   
Comment by Emily Hall [ 03/May/17 ]

Thanks crystal.horn!

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

Hi Lee,
The original behavior was actually unplanned (however, useful in your case). Adding a "wildcard" db would be a feature request. In order to replicate the old behavior will require some light scripting to pull each db name before executing mongodump.

Comment by Lee Theobald [ 28/Dec/12 ]

So does this mean there's now no way to replicate the original functionality we were after - dumping identically named collections, regardless of database? This was a superbly useful feature for our backups & I'd hate to see it disappear. Would it not be possible to at least let us specify a wildcard instead of blocking this altogether?

I might be missing a feature here that would still let me do this, so I'll double check on the mongodb-user group.

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

This fix changes the behavior of mongodump to require specifying a database when specifying a collection.

Comment by auto [ 27/Dec/12 ]

Author:

{u'date': u'2012-12-27T06:34:42Z', u'email': u'dan@10gen.com', u'name': u'Dan Pasette'}

Message: SERVER-7721: require use of --db with --collection for mongodump
Branch: master
https://github.com/mongodb/mongo/commit/109e2bc05ce1b96f35139f46875dfe6411530cad

Comment by Lee Theobald [ 21/Nov/12 ]

I get a slightly different warning but still have the same issue:

lee@whitepudding:~$  /var/lib/mongodb/bin/mongodump -c daily_data
connected to: 127.0.0.1
Wed Nov 21 08:59:00 all dbs
assertion: 13106 nextSafe(): { $err: "Invalid ns [.daily_data]", code: 16256 }

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