Navigation
This version of the documentation is archived and no longer supported. To learn how to upgrade your version of MongoDB Kubernetes Operator, refer to the upgrade documentation.

Upgrade MongoDB Version and FCV

You can upgrade the major, minor, and/or feature compatibility versions of your MongoDB resource. These settings are configured in your resource’s ConfigMap.

Note

If you update spec.version to a later version, consider setting spec.featureCompatibilityVersion to the current working MongoDB version to give yourself the option to downgrade if necessary.

To learn more about feature compatibility, see setFeatureCompatibilityVersion in the MongoDB Manual.

Example

Consider the following ConfigMap for a standalone resource:

---
apiVersion: mongodb.com/v1
kind: MongoDB
metadata:
  name: my-standalone-downgrade
spec:
  version: 4.0.14-ent
  type: Standalone
  project: my-project
  credentials: my-credentials
  persistent: false
...

This resource has a MongoDB version of 4.0.14-ent. The following steps upgrade the deployment’s MongoDB version to 4.2.2-ent:

  1. Perform the following modifications to the resource’s ConfigMap:

    1. Set spec.version to the desired MongoDB version.
    2. Set spec.featureCompatibilityVersion to the current working MongoDB version:
    ---
    apiVersion: mongodb.com/v1
    kind: MongoDB
    metadata:
      name: my-standalone-downgrade
    spec:
      version: 4.2.2-ent
      featureCompatibilityVersion: 4.0
      type: Standalone
      project: my-project
      credentials: my-credentials
      persistent: false
    ...
    

    Note

    Setting featureCompatibilityVersion to "4.0" disables 4.2 features incompatible with MongoDB 4.0.

  2. Reapply the configuration to Kubernetes:

    kubectl apply -f <standalone-config>.yaml
    

Kubernetes automatically reconfigures your deployment with the new specifications. You can see these changes reflected in the Ops Manager or Cloud Manager application.