Navigation

dropStore

Beta

The Atlas Data Lake is available as a Beta feature. The product and the corresponding documentation may change at any time during the Beta stage. For support, see Atlas Support.

The dropStore command removes a data store from the Atlas Data Lake storage configuration. If existing collections reference the data store you want to remove, the command fails and returns a list of the dependent collections.

Syntax

db.runCommand({ dropStore: "<store-name>" })

Parameters

Parameter Type Description Required?
dropStore string Name of the data store to remove from the Atlas Data Lake storage configuration. yes

Output

The command prints the following output if it succeeds. If the command fails, see Troubleshoot Errors for recommended solutions.

{ "ok" : 1, "dropped" : "<store-name>" }

Example

The following example uses the dropStore command to remove the data store myStore from the Atlas Data Lake storage configuration.

use sample
db.runCommand({ dropStore: "myStore" })

The previous command prints the following output:

{ "ok" : 1, "dropped" : "myStore" }

Troubleshoot Errors

If the command fails, it returns one of the following errors.

Reason: The specified data store has dependent collections and can’t be removed.

{
  "ok" : 0,
  "errmsg" : "store has dependent collections: <database.collection>,<database.collection>,<...>",
  "code" : 2,
  "codeName" : "BadValue"
}

Solution: First drop the dependent collections, then re-run the dropStore command.

Reason: The specified data store doesn’t exist.

{
  "ok" : 0,
  "errmsg" : "nonexistent store",
  "code" : 2,
  "codeName" : "BadValue"
}

Solution: Ensure that the data store specified in the command exists in the storage configuration. You can use the listStores command to retrieve a list of valid data stores in the storage configuration.