For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

createStore

The createStore command creates a store in the federated database instance storage configuration. Click on the tab below to learn more about creating a federated database instance store for the data source.

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

Important

Atlas Data Federation doesn't support federated queries across different cloud providers. You can only create federated database instances that map to stores on a single cloud provider.

db.runCommand({ createStore: <store-name>, provider: <storage-provider>, region: <region-name>, bucket: <bucket-name>, additionalStorageClasses: [ <storage-classes> ], delimiter: <delimiter>, public: true|false })
Parameter
Type
Description
Required?

createStore

string

Name of the new federated database instance store. The federated database instance 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.

  • azure for Azure Blob Storage container.

  • atlas for Atlas cluster.

  • http for files hosted at publicly accessible URLs.

  • dls:<subtype> for online archives. Atlas Data Federation supports the following subtypes:

    • aws - for data stored on AWS. Value must be dls:aws.

    • azure - for data stored on Azure. Value must be dls:azure.

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 that Data Federation can access using AWS IAM credentials.

yes

additionalStorageClasses

array of strings

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

Files in the Standard storage class are supported by default.

no

delimiter

string

Character used to separate path segments in the federated database instance store. If ommitted, defaults to "/".

no

public

boolean

Flag that indicates whether or not the bucket is public. Valid values are:

  • true to not use the AWS IAM role to access the bucket

  • false to require the AWS IAM role to access the bucket

If omitted, defaults to false.

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>",
"provider": "<storage-provider>"
}
}

The following example uses the createStore command to create a new federated database instance store called myStore.

use sample
db.runCommand({ createStore: "myStore", provider: "s3", region: "us-east-1", bucket: "my-bucket", "additionalStorageClasses" : ["STANDARD_IA","INTELLIGENT_TIERING"] })
{
"ok": 1,
"store": {
"name": "myStore",
"region": "us-east-1",
"bucket": "my-bucket",
"additionalStorageClasses" : [
"STANDARD_IA",
"INTELLIGENT_TIERING"
],
"delimiter": "/",
"provider": "s3"
}
}

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

Reason: a federated database instance 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 federated database instance 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.