Chapter 4 the database is not available

Although I can find the company.json file and I am supposed to insert it to the database, I faced some problem

1) I can’t use mongoimport
After I direct to where the mongoimport.exe located (in my case it’s /MongoDB/Server/4.2/bin ), but when I type mongoimport in the shell it’s fail, with the error message

mongoimport.exe not found

Although the fact that I can see it in this folder. I can still run mongo and mongod
Small note is that I use Cmder to mimic Linux bash shell

2) Use insertMany()

It’s not really helpful, as there are too many data, and shell crash halfway

So in short, is there any way to import these data to the database?

Hi @Ann_90310 confirm, you are on Windows emulating a Linux machine through Cmder? Any particular reason why?

I suspect that if you run it directly from your host machine’s command line it will work. And besides drivers like MongoClient, I believe that mongoimport is the main command line way of importing JSON data.

1 Like

Hi @007_jb

I just confirm your saying that mongoimport will work if I use default Window command line, which is cmd.exe

To answer your question why I use Cmder to emulate Linux machine, it’s because the Window command line are, first, look too boring with just two main colors, secondly, many documents, articles and guides out there they use Linux bash shell. Plus the command on Linux machine is, by my experience, easier to use. Many options, good syntax. Can set interface if I want

I guess it’s just the issue of emulating Linux machine that cause the command unable to use.
git bash also have same issue when I try it. Just wonder is there any way to go around this problem?

Anyway, thank you for suggest me using default Window command line

Hi @Ann_90310,

Sure it will. I use Widows at home and have been able to run mongoimport on several occasions.

Yeah it’s old school but it still works. :slight_smile: Indeed Linux offers a good shell!

PowerShell perhaps? But if you want a Linux environment that you can play around with, there are a few Intermediate/Advanced MongoDB courses on here that use a Virtual Machine to run an Ubuntu environment. It uses VirtualBox to create the VM and Vagrant to manage the application installations which come bundled with MongoDB. Suggest you check out one of those courses to get to grip with how it’s used or there’s download instructions here.

The courses I was referring to are:

  • Basic Cluster Administration
  • Diagnostics and Debugging
  • MongoDB Performance
1 Like