Mongoimport: command not found (Windows 10, GitBash, localhost)

I’m an aspiring programmer studying MongoDB as my first database experience. I’m following the “Coding with Mosh” Node.js full course, which includes MongoDB as the database (it’s a paid course so I won’t bother linking the tutorial).
Windows 10
Git Bash
MongoDB version 6.0.0
Mongoose 5.13.14

There are a couple threads on this topic from 2020 and 2021 but they were different OS, different problems and different solutions that didn’t help me.

I have been instructed to import a JSON file to my server, which I’m running locally, using the following command:
mongoimport --db mongo-exercises --collection courses --drop --file exercise-data.json --jsonArray

I make sure that I’m in the directory containing the “exercise-data.json” when I run the command.

Stack overflow answers to this exact problem noted that newer versions of MongoDB don’t include the dev tools necessary for this feature, and that they must be downloaded from

So I downloaded them via the MSI option to the default file path, and then as instructed I added that filepath in environment variables. I have filepaths in place for both mongodb and the dev tools:
Environment Paths

Once I had added the paths and it still didn’t work I restarted my system and it still doesn’t work. It still says: mongoimport: command not found.

I would be grateful for any guidance.

One thing I did notice in the documentation for mongoimport is it doesn’t list MongoDB 6.0 among the versions that support mongoimport:

But it doesn’t make any sense for MongoDB 6.0 to drop support for mongoimport so surely this is just because the documentation hasn’t been updated since 6.0 release. Surely I don’t have to downgrade to version 5 just for mongoimport?

Never mind I figured it out. My filepath to the tools was wrong. There was another directory in the 100 folder that I had missed.

Now I’m no longer getting the “command not found” error.

Hey @Benjamin_Mason glad you solved the path issue :slight_smile:

I would also like to suggest some free MongoDB University courses to reinforce your learning, if you’re interested. In particular, M001 MongoDB Basics and M100 MongoDB for SQL Pros if you come from SQL land. We also have M220JS MongoDB for JavaScript Developers.

Welcome and I hope you have a great learning experience :+1:

Best regards
Kevin

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.