databasemongodbshellcommand-linemongodb-java

mongodb script file


I am newbie to mongodb.

We can execute list of queries by specifying it in a script .sql file in relational db and can run it by running the command source c:\test.sql.

How can we do that in mongodb? how to store those commands in mongodb script and how to execute in mongodb?

CloudBees Pipeline Execution Guide for Bulk Deployment Objective This guide is intended for the RUN team to execute the CloudBees bulk deployment pipeline efficiently, ensuring correct preparation, execution, and reporting.

Step-by-Step Instructions

  1. Prepare the Input File for Deployment Obtain the list of microservices with:

UDeploy Application Name

Target Environment (e.g., Dev, QA, etc.)

Target Foundation for deployment

The list will be provided by the ECM team or Application Team.

  1. Normalize the Input File If multiple foundations are mentioned in a single row, split them so that each row corresponds to a single microservice and one target foundation.

  2. Deployment Limitations for Development Environment (DEV) For DEV:

A maximum of 100 deployments should be executed per day.

Deployment time window: 5:30 PM to 11:30 PM EST on weekdays.

  1. Update the Deployment CSV Place the 100 deployment rows under the following repository branch:

bash Copy code /pulf_deployment/CSV/ Ensure the input CSV is formatted correctly according to the expected schema.

  1. Schedule the Build After updating the deployment CSV:

Schedule the pipeline build periodically.

Set the timer to trigger the build on the next day during the EST time window (5:30 PM – 11:30 PM EST).

  1. Monitor the Execution During pipeline execution:

Continuously monitor if UDeploy servers or CloudBees worker nodes are facing downtime.

Immediately escalate any downtime issues.

  1. Engage Monitoring Team Notify the Monitoring Team before the execution window to actively monitor system performance during bulk deployments.

  2. Review Deployment Report Post-execution, the bulk deployment pipeline commits the deployment report automatically to the following branch:

bash Copy code /pulf_deployment/Reports/ Reports are committed with a timestamp for tracking purposes.

  1. Update the Status Tracker Create a status tracker sheet.

Update the tracker with:

Deployment details

Success and failure counts

Any notable error messages

Share the tracker regularly with the ECM Team to keep them informed on the deployment progress.

  1. Validate for Errors Carefully review the error messages in the report.

Example:

Errors may appear in the "error_message" column.

Sample Error:

arduino Copy code Deployment failed: PCF Config Server unreachable 11. Raise Issues to ECM or App Teams If certain microservices fail due to known infrastructure issues (e.g., PCF Config Server issues), report these failures immediately to the ECM or Application Team for their action.


Solution

  • You can do it with shell script. You can execute the commands using the following command.

    ./mongo server:27017/dbname --quiet my_commands.js
    

    For details check Scripting the shell document in Mongo docs.