https://github.com/pualien/pymongo-ssh
Shortcut for pymongo over ssh tunnel
https://github.com/pualien/pymongo-ssh
Last synced: about 1 month ago
JSON representation
Shortcut for pymongo over ssh tunnel
- Host: GitHub
- URL: https://github.com/pualien/pymongo-ssh
- Owner: pualien
- License: mit
- Created: 2021-01-20T10:23:52.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-11-15T12:38:23.000Z (over 1 year ago)
- Last Synced: 2025-04-22T20:08:12.072Z (about 2 months ago)
- Language: Python
- Size: 1.09 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
README

# ssh-pymongo
[](https://pypi.org/project/pymongo-ssh/)
[](https://github.com/pualien/pymongo-ssh/actions)
[](https://pypi.org/project/pymongo-ssh/)
[](https://pypi.org/project/pymongo-ssh/)Python utilities to simplify connection with MongoDB through SSH tunnel.
Note: uri parameter is assumed as local, after ssh.## Where to get it
The source code is currently hosted on GitHub at:
Binary installers for the latest released version are available at the
[Python package index](https://pypi.org/project/pymongo-ssh/)```sh
pip install pymongo-ssh
```### Example 1
```python
from pymongo_ssh import MongoSessionsession = MongoSession('db.example.com')
db = session.connection['db-name']
session.stop()
# session.start()
```### Example 2
```python
session = MongoSession(
host='db.example.com',
uri='mongodb://user:[email protected]/?authSource=admin&authMechanism=SCRAM-SHA-256'
)
...
session.stop()
```### Example 3
```python
session = MongoSession(
host='db.example.com',
user='myuser',
password='mypassword',
)
...
session.stop()
```### Example 4
```python
session = MongoSession(
host='db.example.com',
port='21',
user='myuser',
key='/home/myplace/.ssh/id_rsa2',
to_port='37017',
to_host='0.0.0.0'
)
...
session.stop()
```