> 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="/files/h1U2kJm72xmyPRFztaof" 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
