MongoDB
The robomotion mongodb CLI connects to MongoDB for document database operations. It supports finding, inserting, updating, and deleting documents; running aggregation pipelines; and managing collections.
When to use
- Query documents with filters and projections
- Insert, update, or delete documents in collections
- Run aggregation pipelines for data analysis
- Manage MongoDB connections and collections
Prerequisites
robomotionCLI installed- Package installed:
robomotion install mongodb - MongoDB connection URI configured via Robomotion vault
IMPORTANT: Session Mode Required for Multi-Step Operations
Each CLI command runs as a separate process — connection IDs from connect do NOT persist across calls.
You MUST use --session on connect and pass --session-id to all subsequent commands.
Workflow
- Install (once):
robomotion install mongodb - Connect with session:
robomotion mongodb connect --session --output json # → {"outConnectionId":"<conn-id>","session_id":"<session-id>"} - Use the returned
conn-idandsession-idin all subsequent commands:robomotion mongodb find --conn-id "<conn-id>" --collection <col> --filter <json> --session-id "<session-id>" --output json - Disconnect when done:
robomotion mongodb disconnect --conn-id "<conn-id>" --session-id "<session-id>" --output json
Always append --output json to get structured JSON results.
Commands Reference
robomotion mongodb drop_database --client-id --database-name --session-id "<session-id>" --output jsonDelete an entire MongoDB database and all its collectionsrobomotion mongodb list_databases --client-id --session-id "<session-id>" --output jsonList all databases available on the MongoDB serverrobomotion mongodb connect --session --output jsonConnect to a MongoDB database server using credentialsrobomotion mongodb create_database --client-id --database-name --session-id "<session-id>" --output jsonCreate a new MongoDB databaserobomotion mongodb create_collection --client-id --database-name --collection-name --session-id "<session-id>" --output jsonCreate a new collection in a MongoDB databaserobomotion mongodb drop_collection --client-id --database-name --collection-name --session-id "<session-id>" --output jsonDelete a collection and all its documents from a MongoDB databaserobomotion mongodb insert_document --client-id --database-name --collection-name --session-id "<session-id>" --output jsonInsert one or more documents into a MongoDB collectionrobomotion mongodb delete_document --client-id --database-name --collection-name --session-id "<session-id>" --output jsonDelete documents from a MongoDB collection that match the specified query filterrobomotion mongodb disconnect --client-id --session-id "<session-id>" --output jsonDisconnect from a MongoDB database server and release the client connectionrobomotion mongodb update_document --client-id --database-name --collection-name --session-id "<session-id>" --output jsonUpdate documents in a MongoDB collection that match the specified filterrobomotion mongodb read_document --client-id --database-name --collection-name --session-id "<session-id>" --output jsonQuery and read documents from a MongoDB collection using a filterrobomotion mongodb read_all --client-id --database-name --collection-name --session-id "<session-id>" --output jsonRead all documents from a MongoDB collectionrobomotion mongodb show_collections --client-id --database-name --session-id "<session-id>" --output jsonList all collections in a MongoDB database
Environment
- ROBOMOTION_API_TOKEN (if vault credentials are needed)