MongoDB dump from 3.2, restore with 3.4, error index safe = null

后端 未结 4 947
忘了有多久
忘了有多久 2020-12-25 12:11

I get the following error (dump MongoDB 3.2) (restore MongoDB 3.4):

Failed: ngivr-dev.ledgerhelpers: error creating indexes for ngivr-dev.ledgerhelpers: **cr         


        
4条回答
  •  [愿得一人]
    2020-12-25 12:18

    find . -type f -name "*.metadata.json" -exec sed -i 's/,"safe":null//g' {} \;
    

    This works and you will keep your indexes! It find all files in the present location (.) then using the same process (exec) replace in file (sed -i) according to the following regex which is basically saying all occurrences of "safe":null with nothing.

    Replace the "." argument with the path to the directory where your mongodb exports are stored.

提交回复
热议问题