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

mongodump does not create metadata.json file for views dumped as collections

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 3.5.12, 3.4.9
    • 100.0.0
    • mongodump
    • v3.6

    Description

      When we dump a single collection "foo" with data we end up with two files:

      foo.bson and foo.metadata.json which will at a minimum have the following content:

      {"options":{},"indexes":[{"v":2,"key":{"_id":1},"name":"_id_","ns":"db.foo"}]}
      

      When we dump out a read-only view as a collection due to option "--viewsAsCollections" to mongodump, we only write out a single file, fooview.bson and not the metadata.json file.

      This can result in failure to overwrite a previously written <foo>.metadata.json file that's already in the dump directory (for instance from previous attempt to dump the view without correct flag).

      We should always create the metadata.json file when dumping out view as a collection, so it looks exactly the same as if it were a collection to mongorestore.

      Attachments

        Activity

          People

            varsha.subrahmanyam@mongodb.com Varsha Subrahmanyam
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: