> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Mongo

> You can install MongoDB on Kubernetes environment using Helm. MongoDB installation can be done to meet Apinizer's data storage needs and can be easily managed through Helm chart repository.

<Warning>
  This installation method is **not recommended for production environments.**

  MongoDB is installed as only a single replica and data is stored on the first suitable worker node that does not have control-plane role using hostPath.

  If there is only one node in the cluster, the control-plane label and taint on the node must be removed with the following commands so that the pod can run on this node:

  ```bash theme={null}
  kubectl label node <node-name> node-role.kubernetes.io/control-plane-
  kubectl taint nodes <node-name> node-role.kubernetes.io/control-plane:NoSchedule-
  ```

  It is recommended to use NFS, Ceph, Longhorn or a cloud-based storage solution so that data can be stored independently of nodes.
</Warning>

## Prerequisites

Before starting the installation, make sure the following requirements are met:

* Kubernetes cluster is ready and accessible
* Helm is installed in your environment

<Note>
  If Helm is not installed, you can review the [Helm Installation Document](/en/setup/helm/apinizer) page.
</Note>

## 1) Adding Repository

```bash theme={null}
helm repo add mongodb-charts https://apinizer1.github.io/mongodb-charts
helm repo update
```

## 2) Mongo Installation

You can perform MongoDB installation without any special settings by running the following command:

```bash theme={null}
helm install mongodb-charts mongodb-charts/mongo
```

<Info>
  **Note:** Version `mongo:8.0` is used in the current installation. If you want to prefer a more up-to-date version, you can use version `mongo:8.0`. You can review all Mongodb versions on [Docker Hub](https://hub.docker.com/_/mongo/tags).
</Info>

## Optional Parameters

| Option        | Default Value | Description                             |
| ------------- | ------------- | --------------------------------------- |
| `image.mongo` | `mongo:8.0`   | Specifies the version of MongoDB image. |

If you want to use a different MongoDB version, you can specify the version by adding the optional parameter as in the example below in your Helm installation command:

```bash theme={null}
helm install mongo-charts mongo-charts/mongo --set image.mongo=mongo:latest
```

## 3) Installation Information

| Field              | Description                                                                                                                                |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
| **TZ (Time Zone)** | Europe/Istanbul – Set with TZ environment variable inside the container. Thus, application and MongoDB logs work according to Turkey time. |
| **Database**       | `apinizerdb`                                                                                                                               |
| **Username**       | `kubectl get secret -n mongo mongodb-secret -o jsonpath="{.data.MONGO_ROOT_USERNAME}" &#124; base64 --decode; echo`                        |
| **Password**       | `kubectl get secret -n mongo mongodb-secret -o jsonpath="{.data.MONGO_ROOT_PASSWORD}" &#124; base64 --decode; echo`                        |
| **Port**           | `25080`                                                                                                                                    |
| **Data directory** | `/mnt/data` this directory is mapped with the path on your host machine (hostPath). Thus, data is kept on the host and is persistent.      |
