Import more than 1 json file using mongoimport

前端 未结 12 1425
猫巷女王i
猫巷女王i 2020-11-30 00:27

I am new to mongodb and want to know about importing a json file from one server to another. I tried the following command mongoimport -d tes

12条回答
  •  执念已碎
    2020-11-30 00:48

    For windows bat file. This would be way better if you have a list of json files in the folder. and the collection name matches the name in files

    @echo off
    for %%f in (*.json) do (
        "mongoimport.exe" --db databasename --collection %%~nf --drop --file %%f
    )
    pause
    

提交回复
热议问题