YAML examples for Mongosh CLI
Execute MongoDB commands
yaml
- action: "Run MongoDB queries"
type: "MONGOSH_CLI"
trigger_time: "ON_EVERY_EXECUTION"
version: "8.0"
shell: "BASH"
commands: |-
mongosh --quiet "$MONGOSH_URI" --eval 'db.stats()'
mongosh --quiet "$MONGOSH_URI" script.js
setup_commands: "apt-get install -y curl"
targets:
- target: my_mongo
type: MONGO
name: My MongoDB
host: mongo.example.com
database: myapp
auth_source: admin
auth:
username: user
password: pass