A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mongodb.com/docs/compass/current/embedded-shell/ below:

Embedded MongoDB Shell - Compass

Starting in version 1.22, MongoDB Compass contains an embedded shell, mongosh. mongosh is a JavaScript environment for interacting with MongoDB deployments. You can use mongosh to test queries and operations in your database.

To open the embedded mongosh,you can either:

By default, mongosh, connects to the test database. To use a different database, run the following command in mongosh:

To run an operation in the embedded MongoDB Shell, type the operation into the shell and press Enter.

The following example runs a db.collection.find() operation:

Example
db.employees.find( { "last_name": "Smith" } )

To write an operation that spans multiple lines in the embedded mongosh, begin with the first line, then press Shift + Enter to move to the next line of code.

When you are finished writing your operation, press Enter to run it.

The following multi-line example runs the $match stage in an aggregation pipeline:

Example
db.employees.aggregate( [                { $match: { "last_name": "Smith" } } ] )                                    

You can disable the embedded MongoDB shell in Compass to avoid running unauthorized commands on mongosh.

To disable the embedded MongoDB shell:

Compass opens a dialog box where you configure your MongoDB Compass settings.

If you select Set Read-Only Mode, Compass automatically unchecks the Enable MongoDB Shell setting.

The following links direct to the mongosh documentation, which contains more a complete reference for mongosh, including syntax and behaviors.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4