- API >
- Public API Tutorials >
- Update the MongoDB Version of a Deployment
Update the MongoDB Version of a Deployment¶
On this page
Overview¶
This tutorial describes how to use the API to migrate a
MongoDB deployment to a new version of MongoDB. These steps assume you
have an existing deployment that uses a 3.2.12
version of MongoDB, as
would be the case if you used the tutorial to
Deploy a Cluster through the API.
Consideration¶
The API supports the MongoDB options listed on the Supported MongoDB Options for Automation page.
Prerequisite¶
You must have credentials to access Ops Manager as a user with the Global Owner role.
Procedure¶
Retrieve the automation configuration from Ops Manager.¶
Use the automationConfig resource
to retrieve the configuration. Issue the following command, replacing
<username>
and <apiKey>
with your API credentials, <url>
with the URL of Ops Manager,
and <group_id>
with the group ID from your Group Settings:
Confirm that the version
field of the retrieved automation
configuration matches the
version
field in the mms-cluster-config-backup.json file,
which is found on any server running the Automation Agent.
Open the configuration document for editing.¶
As you edit the configuration document in the next steps, reference the description of an automation configuration for detailed descriptions of settings.
Add the new MongoDB version number to the configuration document.¶
Update the mongoDbVersions
array to include {"name": "3.4.3"}
:
Update the MongoDB version in the processes
array.¶
Update each document in the processes
array as follows.
Update the processes.version
field to specify 3.4.3
:
Send the updated automation configuration.¶
Use the automationConfig resource to send the updated automation configuration.
Issue the following command, replacing <configuration>
with path to the
updated configuration document. Replace the username, API key, URL, and
group ID as in previous steps.
Upon successful update of the configuration, the API returns the HTTP
200 OK
status code to indicate the request has succeeded.
Confirm successful update of the automation configuration.¶
Retrieve the automation configuration from Ops Manager and confirm it contains the changes. To retrieve the configuration, issue the following command, replacing username, API key, URL, and group ID as in previous steps.
Check the deployment status to ensure goal state is reached.¶
Use the automationStatus resource to retrieve the deployment status. Issue the following command, replacing username, API key, URL, and group ID as in previous steps.
Confirm that the values of all the lastGoalVersionAchieved
fields in the
processes
array match the goalVersion
field. For more information on
deployment status, see Automation Status.