Core Server
  1. Core Server
  2. SERVER-1970

Add --gridfsnamespace option to "mongofiles" tool

    Details

    • Backport:
      No
    • # Replies:
      12
    • Last comment by Customer:
      true

      Description

      Hi,

      Need to add --gridfsamespace option to make possible to specify the concrete gridfs namespace (prefix) to work with. For now, it just uses hardcoded "db.fs" namespace and it's not possible to override it.

        Issue Links

          Activity

          Hide
          Ronny Roeller
          added a comment -

          Workaround:
          1. Import files to the standard bucket 'fs' with mongofiles
          2. Export 'fs.files' and 'fs.chunks' with mongoexport
          3. Import exports to <bucket>.files and <bucket>.chunks with mongoimport

          Is this safe?

          Show
          Ronny Roeller
          added a comment - Workaround: 1. Import files to the standard bucket 'fs' with mongofiles 2. Export 'fs.files' and 'fs.chunks' with mongoexport 3. Import exports to <bucket>.files and <bucket>.chunks with mongoimport Is this safe?
          Hide
          Scott Hernandez
          added a comment -

          Yes, you can dump/restore and renamed the files to move the collections, but this is not complete. Also, do not use mongoexport/import – use mongodump/restore. You will need to create the indexes as well in the new namespace (db.collection name).

          Probably easier than this it to simply rename the collections if you just want to move from the default bucket to a new bucket name.

          This is not a workaround since it doesn't allow the tool to work with multiple buckets concurrently.

          Show
          Scott Hernandez
          added a comment - Yes, you can dump/restore and renamed the files to move the collections, but this is not complete. Also, do not use mongoexport/import – use mongodump/restore. You will need to create the indexes as well in the new namespace (db.collection name). Probably easier than this it to simply rename the collections if you just want to move from the default bucket to a new bucket name. This is not a workaround since it doesn't allow the tool to work with multiple buckets concurrently.
          Hide
          Mark Severson
          added a comment - - edited

          I have patches coded (but untested) for having mongofiles use the --collection parameter or adding a new --gridfsnamespace parameter, if you would like me to create a pull request for either of them?

          The later also resolves SERVER-2334. (accidentally, I didn't even look at SERVER-2334 until I was done coding it)

          Show
          Mark Severson
          added a comment - - edited I have patches coded (but untested) for having mongofiles use the --collection parameter or adding a new --gridfsnamespace parameter, if you would like me to create a pull request for either of them? The later also resolves SERVER-2334 . (accidentally, I didn't even look at SERVER-2334 until I was done coding it)
          Hide
          Ian Whalen
          added a comment -

          Mark, definitely feel free to open a pull request in github for either, and don't forget to check the contributor guidelines for the necessary steps first: https://github.com/mongodb/mongo/blob/master/CONTRIBUTING.rst

          This includes the need to sign the contributor agreement and include any necessary tests.

          Show
          Ian Whalen
          added a comment - Mark, definitely feel free to open a pull request in github for either, and don't forget to check the contributor guidelines for the necessary steps first: https://github.com/mongodb/mongo/blob/master/CONTRIBUTING.rst This includes the need to sign the contributor agreement and include any necessary tests.
          Hide
          Mark Severson
          added a comment -

          I completed the contributor agreement and submitted pull request 347.

          I tried to keep with the style in the surrounding files, but I can fix the styling if needed. I believe the code is correct, it was relatively straight forward, however, I have not had enough time to get MongoDB compiling yet. (I may try to find a bit of time over the next week or two if someone who already has it compiling doesn't try it first)

          Show
          Mark Severson
          added a comment - I completed the contributor agreement and submitted pull request 347 . I tried to keep with the style in the surrounding files, but I can fix the styling if needed. I believe the code is correct, it was relatively straight forward, however, I have not had enough time to get MongoDB compiling yet. (I may try to find a bit of time over the next week or two if someone who already has it compiling doesn't try it first)

            People

            • Votes:
              20 Vote for this issue
              Watchers:
              20 Start watching this issue

              Dates

              • Created:
                Updated:
                Days since reply:
                1 year, 16 weeks, 1 day ago
                Date of 1st Reply: