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

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 100.0.0
    • Affects Version/s: 3.5.12, 3.4.9
    • Component/s: mongodump
    • 1
    • v3.6

      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.

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

              Created:
              Updated:
              Resolved: