> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

# getTransitionToDedicatedConfigServerStatus (database command)

## Definition

Shows the status of the transition from an embedded config server to a dedicated config server.

The command returns `ok: 0` with an error if the transition fails, otherwise it returns `ok: 1`.

To start transitioning to a dedicated config server, see the [`startTransitionToDedicatedConfigServer`](https://www.mongodb.com/docs/manual/reference/command/starttransitiontodedicatedconfigserver.md#mongodb-dbcommand-dbcmd.startTransitionToDedicatedConfigServer) command.

To stop the in-progress transition from an embedded config server to a dedicated config server, see the [`stopTransitionToDedicatedConfigServer`](https://www.mongodb.com/docs/manual/reference/command/stoptransitiontodedicatedconfigserver.md#mongodb-dbcommand-dbcmd.stopTransitionToDedicatedConfigServer) command.

To commit the transition from an embedded config server to a dedicated config server, see the [`commitTransitionToDedicatedConfigServer`](https://www.mongodb.com/docs/manual/reference/command/committransitiontodedicatedconfigserver.md#mongodb-dbcommand-dbcmd.commitTransitionToDedicatedConfigServer) command.

**Tip:**

In [`mongosh`](https://www.mongodb.com/docs/mongodb-shell.md#std-program-mongosh), this command can also be run through the [`sh.shardDrainingStatus()`](https://www.mongodb.com/docs/manual/reference/method/sh.sharddrainingstatus.md#mongodb-method-sh.shardDrainingStatus) and.

Helper methods are convenient for [`mongosh`](https://www.mongodb.com/docs/mongodb-shell.md#std-program-mongosh) users, but they may not return the same level of information as database commands.  In cases where the convenience is not needed or the additional return fields are required, use the database command.

**New in version 8.3**

## Compatibility

This command is available in deployments hosted in the following environments:

- [MongoDB Enterprise](https://www.mongodb.com/docs/manual/administration/install-enterprise.md#std-label-install-mdb-enterprise): The subscription-based, self-managed version of MongoDB

- [MongoDB Community](https://www.mongodb.com/docs/manual/administration/install-community.md#std-label-install-mdb-community-edition): The source-available, free-to-use, and self-managed version of MongoDB

**Note:**

This command is not supported in [MongoDB Atlas](https://www.mongodb.com/docs/atlas). See [Modify your Atlas Sharded Cluster](https://www.mongodb.com/docs/atlas/cluster-additional-settings/#atlas-managed-config-servers-for-sharded-clusters) to drain the embedded config server.

## Syntax

The command has the following syntax:

```javascript
db.adminCommand( {
     getTransitionToDedicatedConfigServerStatus: 1
} )
```

## Output Fields

This command returns the following output:

| Field | Type | Description |
| --- | --- | --- |
| `msg` | string | Provides the current draining operation being performed by the balancer. |
| `state` | string | Provides the status of the transition to a dedicated config server. |
| `remaining` | document | Shows the remaining tasks the balancer must perform to drain the shard before fully transitioning to a dedicated config server. |
| `remaining.chunks` | long | Indicates the number of chunks still on the shard. |
| `remaining.dbs` | long | Indicates the number of databases still on the shard. |
| `remaining.jumboChunks` | long | Indicates the number of large chunks still on the shard. |
| `remaining.collectionsToMove` | long | Indicates the number of collections still on the shard. |
| `remaining.estimatedRemainingBytes` | long | Estimated number of bytes remaining on the shard undergoing removal. |
| `note` | string | Provides additional message for the user. |
| `dbsToMove` | array | Indicates databases that use the draining shard as the [primary shard](https://www.mongodb.com/docs/manual/reference/glossary.md#std-term-primary-shard). Before you can fully transition to a dedicated config server, you must manually move these databases to a new shard using the [`movePrimary`](https://www.mongodb.com/docs/manual/reference/command/moveprimary.md#mongodb-dbcommand-dbcmd.movePrimary) command. |
| `collectionsToMove` | array | Indicates unsharded collections stored on the draining shard. Before you can fully transition to a dedicated config server, you must manually move these collections to another shard using the [`moveCollection`](https://www.mongodb.com/docs/manual/reference/command/movecollection.md#mongodb-dbcommand-dbcmd.moveCollection) command. |
| `pendingRangeDeletions` | long | The number of pending range deletions remaining on the shard undergoing removal. Present only during a [`transitionToDedicatedConfigServer`](https://www.mongodb.com/docs/manual/reference/command/transitiontodedicatedconfigserver.md#mongodb-dbcommand-dbcmd.transitionToDedicatedConfigServer) operation, after the balancer has moved all chunks and databases off the config server. |
| `firstNonEmptyCollection` | string | The first non-empty collection on the shard undergoing removal. Present only during a [`transitionToDedicatedConfigServer`](https://www.mongodb.com/docs/manual/reference/command/transitiontodedicatedconfigserver.md#mongodb-dbcommand-dbcmd.transitionToDedicatedConfigServer) operation, after the balancer has moved all chunks and databases off the config server. |

## Behavior

### Access Requirements

If you have [`authorization`](https://www.mongodb.com/docs/manual/reference/configuration-options.md#mongodb-setting-security.authorization) enabled, you must have the [`clusterManager`](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#mongodb-authrole-clusterManager) role or any role that includes the [`removeShard`](https://www.mongodb.com/docs/manual/reference/privilege-actions.md#mongodb-authaction-removeShard) action.

### Database Migration Requirements

If the embedded config server is also the primary of one of the cluster's databases, then you must manually move the databases to a new shard after migrating all data from the shard. See the [`movePrimary`](https://www.mongodb.com/docs/manual/reference/command/moveprimary.md#mongodb-dbcommand-dbcmd.movePrimary) command and the [Remove Shards from a Sharded Cluster](https://www.mongodb.com/docs/manual/tutorial/remove-shards-from-cluster.md#std-label-remove-shards-from-cluster-tutorial) for more information.

### Collection Migration Requirements

If one of the unsharded collections is on the embedded config server, you must first migrate the collection to a different shard.

To migrate an unsharded collection, see the [`moveCollection`](https://www.mongodb.com/docs/manual/reference/command/movecollection.md#mongodb-dbcommand-dbcmd.moveCollection) command.

## Examples

To start the transition to a dedicated config server, use the [`db.adminCommand()`](https://www.mongodb.com/docs/manual/reference/method/db.admincommand.md#mongodb-method-db.adminCommand) method to run the [`startTransitionToDedicatedConfigServer`](https://www.mongodb.com/docs/manual/reference/command/starttransitiontodedicatedconfigserver.md#mongodb-dbcommand-dbcmd.startTransitionToDedicatedConfigServer) command:

```javascript
db.adminCommand( { startTransitionToDedicatedConfigServer: 1 } )
```

To check the status of the draining operation, use the `getTransitionToDedicatedConfigServerStatus` command:

```javascript
db.adminCommand( { getTransitionToDedicatedConfigServerStatus: 1 } )
```

**Output:**

```javascript
{
        "state" : "ongoing",
        "remaining" : {
                "chunks" : NumberLong(2),
                "collectionsToMove" : NumberLong(1),
                "dbs" : NumberLong(1),
                "jumboChunks" : NumberLong(0),
                "estimatedRemainingBytes" : NumberLong(18)
     },
        "msg" : "draining ongoing",
        "dbsToMove" : [
                "testDB"
    ],
        "note" : "you need to call moveCollection for collectionsToMove and afterwards movePrimary for the dbsToMove",
        "collectionsToMove" : [
                "testDB.testCollUnsharded"
     ],
        "ok" : 1,
        "$clusterTime" : {
                "clusterTime" : Timestamp(1772210444, 27),
                "signature" : {
                        "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                        "keyId" : NumberLong(0)
            }
     },
        "operationTime" : Timestamp(1772210444, 27)
  }
```

## Learn More

- [`startTransitionToDedicatedConfigServer`](https://www.mongodb.com/docs/manual/reference/command/starttransitiontodedicatedconfigserver.md#mongodb-dbcommand-dbcmd.startTransitionToDedicatedConfigServer)

- [`stopTransitionToDedicatedConfigServer`](https://www.mongodb.com/docs/manual/reference/command/stoptransitiontodedicatedconfigserver.md#mongodb-dbcommand-dbcmd.stopTransitionToDedicatedConfigServer)

- [`commitTransitionToDedicatedConfigServer`](https://www.mongodb.com/docs/manual/reference/command/committransitiontodedicatedconfigserver.md#mongodb-dbcommand-dbcmd.commitTransitionToDedicatedConfigServer)
