Atlas Data Federation supports publicly accessible URLs as federated database instance stores. You must define mappings in your federated database instance to your HTTP data stores to run queries against your data.
Important
Information in your storage configuration is visible internally at MongoDB and stored as operational data to monitor and improve the performance of Atlas Data Federation. So, we recommend that you do not use PII in your configurations.
Example Configuration for HTTP Data Store
Consider URLs https://www.datacenter-hardware.com/data.json,
https://www.datacenter-software.com/data.json, and
https://www.datacenter-metrics.com/data.json containing data
collected from a datacenter. The following configuration:
Specifies the publicly accessible URLs that contain data in files as a federated database instance store.
Creates a partition for each URL.
{ "stores" : [ { "name" : "httpStore", "provider" : "http", "allowInsecure" : false, "urls" : [ "https://www.datacenter-hardware.com/data.json", "https://www.datacenter-software.com/data.json" ], "defaultFormat" : ".json" } ], "databases" : [ { "name" : "dataCenter", "collections" : [ { "name" : "inventory", "dataSources" : [ { "storeName" : "httpStore", "allowInsecure" : false, "urls" : [ "https://www.datacenter-metrics.com/data" ], "defaultFormat" : ".json" } ] } ] } ] }
Configuration Format
The federated database instance configuration has the following format:
1 { 2 "stores" : [ 3 { 4 "name" : "<string>", 5 "provider": "<string>", 6 "defaultFormat" : "<string>", 7 "allowInsecure": <boolean>, 8 "urls": ["<string>"] 9 } 10 ], 11 "databases" : [ 12 { 13 "name" : "<string>", 14 "collections" : [ 15 { 16 "name" : "<string>", 17 "dataSources" : [ 18 { 19 "storeName" : "<string>", 20 "allowInsecure" : <boolean>, 21 "urls" : ["<string>"], 22 "defaultFormat" : "<string>", 23 "provenanceFieldName": "<string>" 24 } 25 ] 26 } 27 ], 28 "views" : [ 29 { 30 "name" : "<string>", 31 "source" : "<string>", 32 "pipeline" : "<string>" 33 } 34 ] 35 } 36 ] 37 }
stores- The
storesobject defines each data store associated with the federated database instance. The federated database instance store captures files stored at publicly accessible URLs. Data Federation can only access data stores defined in thestoresobject. databases- The
databasesobject defines the mapping between each federated database instance store defined instoresand MongoDB collections in the databases.
stores
1 "stores" : [ 2 { 3 "name" : "<string>", 4 "provider" : "<string>", 5 "allowInsecure": <boolean>, 6 "urls" : ["<string>"], 7 "defaultFormat" : "<string>" 8 } 9 ]
storesArray of objects where each object represents a data store to associate with the federated database instance. The federated database instance store captures files in an S3 bucket, documents in Atlas cluster, or files stored at publicly accessible URLs. Atlas Data Federation can only access data stores defined in the
storesobject.
stores.[n].nameName of the federated database instance store. The
databases.[n].collections.[n].dataSources.[n].storeNamefield references this value as part of mapping configuration.
stores.[n].providerDefines where the data is stored. Value can be one of the following:
s3for an AWS S3 bucket.atlasfor a collection in an Atlas cluster.httpfor data in files hosted at publicly accessible URLs.
stores.[n].allowInsecureOptional. Validates the scheme in the specified URLs. Value can be one of the following:
trueto allow insecure HTTP schemefalseto only allow secure HTTPS scheme (default)
If true, Atlas Data Federation:
Does not verify the server's certificate chain and hostname.
Accepts any certificate with any hostname presented by the server.
WARNING: If you set this to
true, your data might become vulnerable to a man-in-the-middle attack, which can compromise the confidentiality and integrity of your data. Set this totrueonly for testing and getting started with Atlas Data Federation.If omitted, defaults to
false. If set tofalse, Data Federation returns an error similar to the following if a specified URL contains insecure HTTP scheme:The insecure HTTP scheme is not supported by default - please add a "allowInsecure: true" flag to query from such URLs.
stores.[n].urlsOptional. Comma-separated list of publicly accessible HTTP URLs where data is stored. You can't specify URLs that require authentication.
stores.[n].defaultFormatOptional. Default format that Data Federation assumes if it encounters a file without an extension while searching the
databases.[n].collections.[n].dataSources.[n].storeName.The following values are valid for the
defaultFormatfield:.json,.json.gz,.bson,.bson.gz,.avro,.avro.gz,.orc,.tsv,.tsv.gz,.csv,.csv.gz,.parquetNote
If your file format is
CSVorTSV, you must include a header row in your data. See CSV and TSV for more information.If omitted, Data Federation attempts to detect the file type by processing a few bytes of the file.
The specified format only applies to the URLs specified in the
storesobject.
databases
1 "databases" : [ 2 { 3 "name" : "<string>", 4 "collections" : [ 5 { 6 "name" : "<string>", 7 "dataSources" : [ 8 { 9 "storeName" : "<string>", 10 "allowInsecure" : <boolean>, 11 "urls" : ["<string>"], 12 "defaultFormat" : "<string>", 13 "provenanceFieldName": "<string>" 14 } 15 ] 16 } 17 ] 18 } 19 ]
databasesArray of objects where each object represents a database, its collections, and, optionally, any views on the collections. Each database can have multiple
collectionsandviewsobjects.
databases.[n].nameName of the database to which Atlas Data Federation maps the data contained in the data store.
databases.[n].collectionsArray of objects where each object represents a collection and data sources that map to a
storesfederated database instance store. For dynamically generated databases, you can define only one wildcard (*) collection object in the storage configuration.
databases.[n].collections.[n].nameName of the collection to which Atlas Data Federation maps the data contained in each
databases.[n].collections.[n].dataSources.[n].storeName. Each object in the array represents the mapping between the collection and an object in thestoresarray.Note
You can't generate wildcard
*collections.
databases.[n].collections.[n].dataSourcesArray of objects where each object represents a
storesfederated database instance store to map with the collection.
databases.[n].collections.[n].dataSources.[n].storeNameName of a federated database instance store to map to the
<collection>. Must match thenameof an object in thestoresarray.
databases.[n].collections.[n].dataSources.[n].allowInsecureOptional. Validates the scheme in the specified URLs. Value can be one of the following:
trueto allow insecure HTTP schemefalseto only allow secure HTTPS scheme (default)
If true, Atlas Data Federation:
Does not verify the server's certificate chain and hostname.
Accepts any certificate with any hostname presented by the server.
WARNING: If you set this to
true, your data might become vulnerable to a man-in-the-middle attack, which can compromise the confidentiality and integrity of your data. Set this totrueonly for testing and getting started with Atlas Data Federation.If omitted, defaults to
false. If set tofalse, Data Federation returns an error similar to the following if a specified URL contains insecure HTTP scheme:The insecure HTTP scheme is not supported by default - please add a "allowInsecure: true" flag to query from such URLs.
databases.[n].collections.[n].dataSources.[n].urlsOptional. Comma-separated list of publicly accessible URLs where the data is stored. Federated Database Instance creates a partition for each URL. You can specify URLs that are not in the
urls; however, the collection will contain a union of data from URLs in both theurlsandurls. If omitted, Data Federation uses theurlsin the specifiedstoreName.
databases.[n].collections.[n].dataSources.[n].defaultFormatOptional. Default format that Data Federation assumes if it encounters a file without an extension while searching the
databases.[n].collections.[n].dataSources.[n].storeName.The following values are valid for the
defaultFormatfield:.json,.json.gz,.bson,.bson.gz,.avro,.avro.gz,.orc,.tsv,.tsv.gz,.csv,.csv.gz,.parquetNote
If your file format is
CSVorTSV, you must include a header row in your data. See CSV and TSV for more information.If omitted, Data Federation attempts to detect the file type by processing a few bytes of the file.
The specified format only applies to the URLs specified in the
databases.[n].collections.[n].dataSourcesobject.
databases.[n].collections.[n].dataSources.[n].provenanceFieldNameName for the field that includes the provenance of the documents in the results. If you specify this setting in the storage configuration, Atlas Data Federation returns the following fields for each document in the result:
Field NameDescriptionproviderProvider (
stores.[n].provider) in the federated database instance storage configurationuriHTTP or HTTPS URL (
databases.[n].collections.[n].dataSources.[n].urls) of the documentYou can't configure this setting using the Visual Editor in the Atlas UI.
databases.[n].viewsArray of objects where each object represents an aggregation pipeline on a collection. To learn more about views, see Views.
databases.[n].views.[n].sourceName of the source collection for the view. If you want to create a view with a $sql stage, you must omit this field as the SQL statement will specify the source collection.
databases.[n].views.[n].pipelineAggregation pipeline stage(s) to apply to the
sourcecollection. You can also create views using the $sql stage.