Navigation

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.6
  type: Standalone
  project: my-project
  credentials: my-credentials
  persistent: false
...

This resource has a MongoDB version of 4.0.6. The following steps upgrade the deployment’s MongoDB version to 4.2.0:

  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.0
      featureCompatibilityVersion: 3.6
      type: Standalone
      project: my-project
      credentials: my-credentials
      persistent: false
    ...
    

    Note

    Setting featureCompatibilityVersion to 4.2 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.