MongoDB 4 Quick Start Guide
上QQ阅读APP看书,第一时间看更新

Why use the mongo shell?

A fair question to ask is why use the mongo shell? After all, given that the wonderful graphical utility MongoDB Compass is provided free-of-charge, why bother with the shell? The answer lies in the very nature of Compass; it's graphical in nature, which means you are out of luck when a customer in another city (or even another country!) calls you late on a Friday to tell you the database is down. 

Although Compass can connect remotely, its requirements are much more demanding, and you would most likely need the support of the customer IT department to successfully connect. The mongo shell, on the other hand, is text based and only requires a simple, relatively common SSH connection to a server on the customer site.

Another massive advantage of the mongo shell over Compass is that the shell can run scripts. Getting back to the late Friday Emergency scenario, imagine being able to upload and run a rescue script over an SSH connection, rather than trying to perform manual surgery on the customer's database using Compass.