Navigation

createStore

The createStore command creates a store in the Atlas Data Lake storage configuration. Click on the tab below to learn more about creating a data store for the data source.

This tab contains the syntax and parameters for creating a data store for data in AWS S3 bucket.

db.runCommand({ createStore: <store-name>, provider: <storage-provider>, region: <region-name>, bucket: <bucket-name>, additionalStorageClasses: [ <storage-classes> ], delimiter: <delimiter>, prefix: <prefix> })
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 service where the data is stored. Value can be one of the following:

  • s3 for an AWS S3 bucket.
  • atlas for Atlas cluster.
  • http for files hosted at publicly accessible URL s.
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
additionalStorageClasses
array of strings

Array of AWS S3 storage classes. Atlas Data Lake will include the files in these storage classes in the query results. Valid values are:

Note

Files in the Standard storage class are supported by default.

no
delimiter
string
Character used to separate path segments in the data store. If ommitted, defaults to "/".
no
prefix
string
Value prepended to the path. If ommitted, defaults to "".
no

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>",
"additionalStorageClasses": ["<storage-classes>"]
"delimiter": "<delimiter>",
"prefix": "<prefix>",
"provider": "<storage-provider>"
}
}

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", "additionalStorageClasses" : ["STANDARD_IA","INTELLIGENT_TIERING"] prefix: "/sample" })

The previous command prints the following:

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

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.

Give Feedback
←  createdrop →