* Update website folder to indicate deprecation Adds an alert banner to the top of all MDX files within `/website` to indicate deprecation * Update website README
90 lines
3.1 KiB
Plaintext
90 lines
3.1 KiB
Plaintext
---
|
|
layout: docs
|
|
page_title: connect mongo - Command
|
|
description: >-
|
|
The "connect mongo" command performs a target authorization or consumes an existing authorization token, and then launches a proxied MongoDB connection.
|
|
---
|
|
|
|
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
|
|
> [!IMPORTANT]
|
|
> **Documentation Update:** Product documentation previously located in `/website` has moved to the [`hashicorp/web-unified-docs`](https://github.com/hashicorp/web-unified-docs) repository, where all product documentation is now centralized. Please make contributions directly to `web-unified-docs`, since changes to `/website` in this repository will not appear on developer.hashicorp.com.
|
|
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
|
|
|
|
# connect mongo
|
|
|
|
Command: `boundary connect mongo`
|
|
|
|
The `connect mongo` command authorizes a session against a target and invokes a MongoDB client for the connection.
|
|
The command fills in the local address and port.
|
|
|
|
@include 'cmd-connect-env-vars.mdx'
|
|
|
|
|
|
## Examples
|
|
|
|
The following example shows how to connect to a target with the ID `ttcp_eTcMueUYv` using a MongoDB helper:
|
|
|
|
```shell-session
|
|
$ boundary connect mongo -target-id=ttcp_eTcZMueUYv \
|
|
-dbname=northwind \
|
|
-username=superuser \
|
|
-authentication-database=admin \
|
|
-format=table
|
|
```
|
|
|
|
When prompted, you must enter the password for the user, "superuser":
|
|
|
|
<CodeBlockConfig hideClipboard>
|
|
|
|
```plaintext
|
|
Enter password:
|
|
Current Mongosh Log ID: 64a1b2c3d4e5f6789012345
|
|
Connecting to: mongodb://127.0.0.1:12345/northwind?authSource=admin
|
|
Using MongoDB: 7.0.0
|
|
Using Mongosh: 2.0.0
|
|
|
|
northwind> show collections
|
|
orders
|
|
products
|
|
customers
|
|
|
|
northwind> db.products.count()
|
|
77
|
|
|
|
northwind>
|
|
```
|
|
|
|
</CodeBlockConfig>
|
|
|
|
## Usage
|
|
|
|
<CodeBlockConfig hideClipboard>
|
|
|
|
```shell-session
|
|
$ boundary connect mongo [options] [args]
|
|
```
|
|
|
|
</CodeBlockConfig>
|
|
|
|
@include 'cmd-connect-command-options.mdx'
|
|
|
|
### MongoDB options:
|
|
|
|
- `-dbname` `(string: "")` - The database name you want to pass through to the client.
|
|
You can also specify the database name using the **BOUNDARY_CONNECT_DBNAME** environment variable.
|
|
|
|
- `-style` `(string: "mongosh")` - How the CLI attempts to invoke a MongoDB client.
|
|
This value also sets a suitable default for `-exec`, if you did not specify a value.
|
|
The default and currently-understood value is `mongosh`.
|
|
You can also specify how the CLI attempts to invoke a MongoDB client using the **BOUNDARY_CONNECT_MONGO_STYLE** environment variable.
|
|
|
|
- `-username` `(string: "")` - The username you want to pass through to the client.
|
|
This value may be overridden by credentials sourced from a credential store.
|
|
You can also specify a username using the **BOUNDARY_CONNECT_USERNAME** environment variable.
|
|
|
|
- `-authentication-database` `(string: "")` - The authentication database for MongoDB.
|
|
If omitted, mongosh defaults `authSource` to the database name (`-dbname`). If no database is specified, it defaults to `admin`.
|
|
You can also specify the authentication database using the **BOUNDARY_CONNECT_MONGO_AUTHENTICATION_DATABASE** environment variable.
|
|
|
|
|
|
@include 'cmd-option-note.mdx' |