Navigation

createStore

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 createStore command creates a store in the Atlas Data Lake storage configuration.

Syntax

db.runCommand({ createStore: <store-name>, provider: <storage-provider>, region: <region-name>, bucket: <bucket-name>, delimiter: <delimiter>, prefix: <prefix> })

Parameters

Parameter Type Description Required?
createStore string
Name of the new data store.
The data store name must be unique.
yes
provider string
Name of the storage provider where the data is stored.
Value must be s3 for an AWS S3 bucket as a data store.
yes
region string
Region in which the bucket is hosted.
For a list of valid region names, see Amazon Web Services (AWS).
yes
bucket string
Name of the bucket in which data is stored.
Must exactly match the name of an S3 bucket which
Data Lake can access given the configured AWS IAM
credentials.
yes
delimiter string
The character used to define seperations of elements in the
prefix.
If ommitted, defaults to "/".
no
prefix string
Value prepended to the path.
If ommitted, defaults to "".
no

Output

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

{
  "ok": 1,
  "store": {
    "name": "<store-name>",
    "region": "<region-name>",
    "bucket": "<bucket-name>",
    "delimiter": "<delimiter>",
    "prefix": "<prefix>",
    "provider": "<storage-provider>"
  }
}

Example

The following example uses the createStore command to create a new data store called myStore.

use sample
db.runCommand({ createStore: "myStore", provider: "s3", region: "us-east-1", bucket: "my-data-lake", prefix: "/sample" })

The previous command prints the following:

{
  "ok": 1,
  "store": {
    "name": "myStore",
    "region": "us-east-1",
    "bucket": "my-data-lake",
    "delimiter": "/",
    "prefix": "/sample",
    "provider": "s3"
  }
}

Troubleshoot Errors

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

Reason: A data store with the name specified in createStore already exists.

{
  "ok": 0,
  "errmsg": "store <store-name> already exists",
  "code": 2,
  "codeName": "BadValue"
}

Solution: Specify a unique name for the data store.

Reason: The specified provider isn’t recognized.

{
  "ok": 0,
  "errmsg": "unrecognized store provider <storage-provider>",
  "code": 2,
  "codeName": "BadValue"
}

Solution: Ensure that you specify a valid storage provider.