File madorestore metadata.json

I have a file .bsonfrom a MongoDB dump. The dump also creates a file .metadata.jsonthat appears to contain index definitions.

{
    "options": {},
    "indexes": [
        {
            "v": 1,
            "key": {
                "_id": 1
            },
            "name": "_id_",
            "ns": "test.oneMillionDocuments"
        }
    ]
}

I assume that recovering from a file .bsondoes not include indexes.

  • How to use the file .metadata.json? Do I need to restore it separately?

My recovery is completed with the following lines:

2016-02-06T19:18:56.397+0000    [#######################.]  test2.oneMillionRecordsRestore  9.7 GB/9.7 GB  (99.5%)
2016-02-06T19:18:58.475+0000    restoring indexes for collection test2.oneMillionRecordsRestore from metadata
2016-02-06T19:18:58.485+0000    finished restoring test2.oneMillionRecordsRestore (1000000 documents)
2016-02-06T19:18:58.488+0000    done

There is a line that talks about restoring indexes, but in particular, refers to a file .metadata.json.

+4
source share
1 answer

metadata.json: mongorestore, .bson , . , , :

2016-02-06T20:22:08.652+0100    reading metadata for mydb.message from dump/mydb/message.metadata.json

, , , (, ). , , , ( ) .

+7

Source: https://habr.com/ru/post/1627589/


All Articles