> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/public-finance/v2.3/platform/configuration/promotion-docs/mongodb-migration.md).

# MongoDB Migration

As part of the iFIX-2.0-alpha release, we have migrated the following master data from ifix\_db to mgramseva\_db:

1. Adapter Master Data Service
   1. Department
   2. Expenditure
   3. Project
2. Department Entity Service
   1. Department Entity
   2. Department Hierarchy

Out of these, the project data SHOULD NOT be copied to the new DB because a new feature of the multi-tenant (GP) project is introduced with this release. New projects can be created and linked to multiple GPs.

Other master data can be copied.

## Pre-requisites <a href="#pre-requisites" id="pre-requisites"></a>

1. Make sure the playground pod is “dwssio/playground:mongo-v2” or newer.
2. Keep the MongoDB Credentials handy in the following format
   * Host(in this format): “\<host-address>:27017”
   * Username - a user that has access to BOTH source and destination dbs
   * Password
   * Source and Destination DB Names
   * List of collection names to be copied
3. The `mongo-migration.sh` script copied to the playground pod. (You must have necessary kube permissions to copy a file to a pod.)

   * Sample Command to copy the file:\
     `kubectl cp mongo_migration.sh ifix/<playground pod>:/`

<div align="left"><img src="https://2287351256-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FujRjzdG1LUqcmmuo2t2T%2Fuploads%2Fz5Qq76SkzIjl7JtSzJmw%2F2%20(1).jpg?alt=media&amp;token=0f1face0-b360-43d4-b0fa-d2f235977a02" alt=""></div>

## Migration Instructions <a href="#migration-instructions" id="migration-instructions"></a>

A MongoDB Dump script is provided that will copy a list of collections from a source DB to the destination DB.

1. Execute the provided script using following parameters:
   * -h = Host Address
   * -u = username
   * -p = password
   * -s = source db
   * -d = destination db
   * -c = collection name - You can provide multiple collection as depicted in the following example
2. ./mongo-migration.sh -h \<host-address>[:27017](http://aws.com:27017/)  -u \<ifix username> -p \<ifix password> - s \<ifix db> -d \<mgramseva db> -c department -c expenditure -c departmentHierarchyLevel -c departmentEntity

> [![Creative Commons License](https://i.creativecommons.org/l/by/4.0/80x15.png)*​*](http://creativecommons.org/licenses/by/4.0/)*All content on this page by* [*eGov Foundation*](https://egov.org.in/) *is licensed under a* [*Creative Commons Attribution 4.0 International License*](http://creativecommons.org/licenses/by/4.0/)*.*

&#x20;


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.digit.org/public-finance/v2.3/platform/configuration/promotion-docs/mongodb-migration.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
