import json in mongodb code example
Example 1: import csv into mongodb
mongoimport --type csv -d database -c collection --headerline --drop index2020.csv
Example 2: how to import a file from ones directory into mongodb
mongoimport --db test --collection inventory ^
--authenticationDatabase admin --username <user> --password <password> ^
--drop --file ~\downloads\inventory.crud.json
Example 3: how to export mongodb database to json
sudo mongoexport --db newdb -c restaurants --out newdbexport.json