MongoDB Bulk import using mongoimport from Windows folder MongoDB Bulk import using mongoimport from Windows folder mongodb mongodb

MongoDB Bulk import using mongoimport from Windows folder


If you are in a Linux/Unix shell you can try

for filename in *; do mongoimport -d mydb -c $filename;  done

If you are on Windows:

FOR %i IN (C:\mongodbData\*.json) DO mongoimport --db dbName --collection colection --type json --file %i


mongorestore is import all exported mongodb files

cd C:\Program Files\MongoDB\Server\4.0\binmongorestore.exe -d <db name> C:\Users\Mike\Downloads\myProject\

But if you really want to import all only meta json files without .bson

cd C:\Users\Mike\Downloads\myProject\FOR %i IN (*.json) DO "C:\Program Files\MongoDB\Server\4.0\bin\mongoimport.exe" --db <db name> --collection %~ni --type json --file %i

This is sample work on windows 10


You need to use mongorestore for recovery from dump, created by the mongodump

http://docs.mongodb.org/v2.6/reference/program/mongorestore/

for example

mongorestore --drop --oplogReplay mongodb/