The MongoDB Shell

A passionate full-stack developer from @ePlus.DEV
Search for a command to run...

A passionate full-stack developer from @ePlus.DEV
No comments yet. Be the first to comment.
MongoDB is a cross-platform document-oriented database program classified as a NoSQL database. MongoDB uses JSON-like documents with optional schemas. This makes it a flexible and powerful database
Overview In this unit, you will learn about indexes, how indexes support the efficient execution of queries in MongoDB, the trade-offs associated with using indexes, how to create Single Field and Compound Index, what Multikey indexes are, and how to...
Overview In a challenge lab you’re given a scenario and a set of tasks. Instead of following step-by-step instructions, you will use the skills learned from the labs in the course to figure out how to

🏕️ Arcade Base Camp August 2026 Welcome to Arcade Base Camp August 2026, where you’ll develop key Google Cloud skills and earn an exclusive credential that will open doors to the cloud for you. No pr

Một bản tin giúp Developer cập nhật nhanh AI, Cloud, Open Source và những công nghệ đáng chú ý trong ngày. 📌 Executive Summary Google Cloud giới thiệu hai Database Operations Agents hỗ trợ onboard

Một bản tin giúp Developer cập nhật nhanh AI, Cloud, Open Source và những công nghệ đáng chú ý trong ngày. 📌 Executive Summary SK hynix và Sandisk công bố đặc tả mở đầu tiên cho High Bandwidth Fla

Challenge overview In a challenge lab you’re given a scenario and a set of tasks. Instead of following step-by-step instructions, you will use the skills learned from the labs in the course to figure

In this unit, you'll learn about the MongoDB Shell (mongosh), the command line interface that enables you to interact with local and remote MongoDB deployments. You'll learn how to install mongosh and connect to both Atlas and self-managed deployments. Next, you'll learn how to configure and use mongosh along with its companion library (.mongoshrc.js). Finally, you'll learn some tips and tricks for working with mongosh.
Which of the following commands can be used to connect to a database called students on a local MongoDB instance? (Select one.)
A. mongosh
B. mongosh --host localhost --db students
C. mongosh --db students
D. mongosh students
Which of the following are valid methods for connecting mongosh to a MongoDB Atlas cluster and selecting the sample_training database? (Select all that apply.)
A. mongosh "mongodb+srv://<clustername>.mongodb.net/?database=sample_training" –username <username>
B. mongosh "mongodb+srv://<username>:<password>@<clustername>.mongodb.net/sample_training"
C. mongosh "mongodb+srv://<clustername>.mongodb.net/" –username <username> --db sample_training
D. mongosh "mongodb+srv://<clustername>.mongodb.net/sample_training" --username <username>
What method from the config API allows you to set a configuration option in mongosh? (Select one.)
A. config.get()
B. config.set()
C. config.apply()
D. db.config.set()
Which of the following settings can be adjusted by editing an option in the mongosh.conf file? (Select all that apply.)
A. The color of the font that’s displayed in mongosh
B. How many items per batch are displayed when using the “it” iterator
C. The editor used by mongosh when using the edit() method
D. Whether mongosh prompts the user for confirmation before running a deleteOne() or deleteMany() command
You want to use an external JavaScript file within an active mongosh session. What method should you use? (Select one.)
A. load()
B. loadjs()
C. run()
D. You cannot use external JavaScript files within an active mongosh session.
What method is used to change databases within a script by using the load() method in mongosh? (Select one.)
A. db.getDb()
B. db.getMongo()
C. use
D. db.getSiblingDB()
Where should the .mongoshrc.js file be located? (Select one.)
A. The same directory as the mongosh executable.
B. The user's home directory.
C. The file must be loaded into the mongosh session by using the load() method.
Which of the following methods terminate an active mongosh session? (Select one.)
A. exit
B. db.exit()
C. db.quit()
Which of the following examples demonstrates the correct usage of the EJSON.stringify() method in mongosh to convert an extended JSON object into a string? (Select one.)
A. EJSON.stringify({ name: “Test User”, dob: new Date(“1990-01-01”)})
B. EJSON.stringify(name: “Test User”, dob: new Date(“1990-01-01”)
C. ({name: “Test User”, dob: new Date(“1990-01-01”)}).EJSON.stringify()
D. EJSON.stringify = { name: “Test User”, dob: new Date(“1990-01-01”)}
A. Option A
B. Option B
C. Option C
D. Option D
In mongosh, what Node.js fs module API method can be used to write the results of a query to a file? (Select one.)
A. fs.write()
B. fs.writeFileSync()
C. fs.commit()
D. EJSON.stringify()
You want to load a script into mongosh that requires an npm package. To do so, where should the npm package be installed? (Select all that apply.)
A. An option for using an npm package in an external script is to install the package globally and then require it in the script.
B. The package can be installed in the node_modules directory in your current working directory. Then it can be added to a mongosh script that can be used with the load() method.
C. mongosh will automatically download and install the necessary dependencies when the script is run in the shell with the load() method.