Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-3

mongodump --dbpath doesn't properly handle query errors

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.8.0-rc1
    • Affects Version/s: None
    • Component/s: mongodump
    • None

      mongodump --dbpath prints query errors to standard out, but never actually handles them. The error document is saved in the .bson file for the collection (corrupting the dump), and the tool exits with an exit code of 0. Verified with 2.4.10, 2.6.1, 2.7.0.

      Reproduce with:

      rassi@laptop:~/work/mongo $ mongodump --dbpath /data/db -d test -c foo -q '{$invalid:1}'
      2014-05-07T12:18:46.449-0400 DATABASE: test	 to 	dump/test
      2014-05-07T12:18:46.451-0400 	test.foo to dump/test/foo.bson
      2014-05-07T12:18:46.451-0400 [tools] assertion 17287 Can't canonicalize query: BadValue unknown top level operator: $invalid ns:test.foo query:{ $invalid: 1 }
      2014-05-07T12:18:46.451-0400 		 1 documents
      2014-05-07T12:18:46.451-0400 	Metadata for test.foo to dump/test/foo.metadata.json
      2014-05-07T12:18:46.451-0400 [tools] dbexit:
      2014-05-07T12:18:46.451-0400 [tools] shutdown: going to close listening sockets...
      2014-05-07T12:18:46.451-0400 [tools] shutdown: going to flush diaglog...
      2014-05-07T12:18:46.451-0400 [tools] shutdown: going to close sockets...
      2014-05-07T12:18:46.451-0400 [tools] shutdown: waiting for fs preallocator...
      2014-05-07T12:18:46.451-0400 [tools] shutdown: closing all files...
      2014-05-07T12:18:46.451-0400 [tools] closeAllFiles() finished
      2014-05-07T12:18:46.451-0400 [tools] shutdown: removing fs lock...
      2014-05-07T12:18:46.451-0400 [tools] dbexit: really exiting now
      rassi@laptop:~/work/mongo $ echo $?
      0
      rassi@laptop:~/work/mongo $ bsondump dump/test/foo.bson
      { "$err" : "Can't canonicalize query: BadValue unknown top level operator: $invalid", "code" : 17287 }
      1 objects found
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            ian@mongodb.com Ian Whalen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: