我已经将collection.bson文件从MongoDB 2.4迁移到MongoDB 3.6.4,作为collection.json。
但是,在collection.metadata.json 2.4中,它们是另外一个文件MongoDB。
如何将其导入MongoDB 3.6.4?
collection.metadata.json的含量如下;
{
"options": {
"create": "collection"
},
"indexes": [
{
"v": 1,
"name": "_id_",
"key": {
"_id": 1
},
"ns": "emgda.collection"
},
{
"v": 1,
"name": "customerId_1_elementId_1_siteId_1_createdTimestamp_1",
"key": {
"customerId": 1,
"elementId": 1,
"siteId": 1,
"createdTimestamp": 1
},
"ns": "emgda.collection",
"background": true,
"sparse": true
}
]
}蒙戈恢复版本如下,
emgda@ubuntu:~/trial$ mongorestore --version
mongorestore version: r3.6.4
git version: d0181a711f7e7f39e60b5aeb1dc7097bf6ae5856
Go version: go1.7
os: linux
arch: amd64
compiler: gc
OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016注意:当我使用
mongoretore -d emgda auditing.bson时,我得到的集合错误如下。
checking for collection data in auditing.bson
reading metadata for emgda.auditing from auditing.metadata.json
Failed: emgda.auditing: error creating collection emgda.auditing: error running create command: BSON field 'OperationSessionInfo.create' is a duplicate field发布于 2019-04-02 12:50:30
我不得不手动从"options": { "create": "collection" },文件中删除*.metadata.json,而rest工作得很好。
https://dba.stackexchange.com/questions/233736
复制相似问题