Courseiva

C100DEV Drivers, Tools, Transactions, and Search Practice Question

A developer needs to load a large JSON file into a collection named 'inventory' in the 'retail' database on a MongoDB server running on localhost. The file contains one JSON document per line. Which command-line tool should be used?

⚠ Common exam trap

Many exam-takers confuse mongoimport with mongorestore, assuming both can import JSON data, but mongorestore only works with BSON dumps.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

mongoimport --db retail --collection inventory --file inventory.json

The correct tool is mongoimport, which is part of the MongoDB Database Tools and specifically built to import data from JSON, CSV, or TSV files into a collection. The other tools serve different purposes: mongorestore restores BSON dumps, mongoexport exports data, and mongofiles manages GridFS files. Only mongoimport matches the requirement of loading a JSON file into a collection.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    mongofiles --db retail --collection inventory --file inventory.json

    Why it's wrong here

    mongofiles is a utility for storing and retrieving files in GridFS, which is used for files exceeding the BSON document size limit. It does not import JSON documents into a regular collection. It manipulates binary file chunks, not structured JSON data, so it is completely inappropriate for this task.

  • ✗

    mongoexport --db retail --collection inventory --file inventory.json

    Why it's wrong here

    mongoexport exports data from a MongoDB collection into JSON or CSV format. It is the opposite of what is needed here, as the goal is to import data into MongoDB, not export it. Using mongoexport would attempt to read from the collection and write to a file, which would not load the data.

  • ✓

    mongoimport --db retail --collection inventory --file inventory.json

    Why this is correct

    mongoimport is specifically designed to import data from JSON, CSV, or TSV files into a MongoDB collection. The --db and --collection flags specify the target database and collection, and --file points to the source file. This is the standard tool for bulk loading JSON data, and it supports one JSON document per line, which matches the scenario.

  • ✗

    mongorestore --db retail --collection inventory inventory.json

    Why it's wrong here

    mongorestore is used to restore binary BSON dumps created by mongodump. It does not accept a plain JSON file as input; it expects a BSON file or a directory containing BSON files. Supplying a JSON file would cause an error or fail to restore data correctly. Therefore, it is not suitable for importing a JSON file.

About these practice questions

One of 259 original C100DEV practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official MongoDB exam blueprint

This C100DEV practice question is part of Courseiva's free MongoDB certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the C100DEV exam.