Skip to main content

Manage DocumentDB assets

Operations on DocumentDB assets (connections, databases, collections).

In general, these should be:

  • Created in top-down order (connection, then database, then collection)
  • Deleted in bottom-up order (collections, then databases, then connections)1

Asset structure

Connection

A DocumentDB connection requires a name and qualifiedName. For creation, specific settings are also required to distinguish it as a DocumentDB connection rather than another type of connection. In addition, at least one of adminRoles, adminGroups, or adminUsers must be provided.

Create a DocumentDB connection
String adminRoleGuid = client.getRoleCache().getIdForName("$admin"); // (1)
Connection connection = Connection.creator( // (2)
"documentdb-connection", // (3)
AtlanConnectorType.DOCUMENTDB, // (4)
List.of(adminRoleGuid), // (5)
List.of("group2"), // (6)
List.of("jsmith")) // (7)
.build();
AssetMutationResponse response = connection.save(client); // (8)
String connectionQualifiedName = response.getCreatedAssets().get(0).getQualifiedName(); // (9)
  1. Retrieve the GUID for the admin role, to use later for defining the roles that can administer the connection.
  2. Build up the minimum request to create a connection.
  3. Provide a human-readable name for your connection, such as production or development.
  4. Set the type of connection to DocumentDB.
  5. List the workspace roles that should be able to administer the connection (or null if none). All users with that workspace role (current and future) will be administrators of the connection. Note that the values here need to be the GUIDs of the workspace roles. At least one of adminRoles, adminGroups, or adminUsers must be provided.
  6. List the group names that can administer this connection (or null if none). All users within that group (current and future) will be administrators of the connection. Note that the values here are the names of the groups. At least one of adminRoles, adminGroups, or adminUsers must be provided.
  7. List the user names that can administer this connection (or null if none). Note that the values here are the usernames of the users. At least one of adminRoles, adminGroups, or adminUsers must be provided.
  8. Actually call Atlan to create the connection. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.
  9. Retrieve the qualifiedName for use in subsequent creation calls. (You'd probably want to do some null checking first.)

DocumentDBDatabase

A DocumentDB database requires a name and a qualifiedName. For creation, you also need to specify the connectionQualifiedName of the connection for the database.

Create a DocumentDB database
DocumentDBDatabase database = DocumentDBDatabase.creator( // (1)
"my-docdb", // (2)
connectionQualifiedName) // (3)
.documentDBDatabaseCollectionCount(10) // (4)
.build();
AssetMutationResponse response = database.save(client); // (5)
database = response.getResult(database); // (6)
  1. Build up the minimum request to create a DocumentDB database.
  2. Provide a human-readable name for your database.
  3. Provide the qualifiedName of the connection for this database.
  4. Optionally provide additional metadata about the database.
  5. Actually call Atlan to create the database. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.
  6. Retrieve the created database for use in subsequent creation calls. (You'd probably want to do some null checking first.)

DocumentDBCollection

A DocumentDB collection requires a name and a qualifiedName. For creation, you also need to specify the databaseQualifiedName of the database that contains the collection.

Create a DocumentDB collection
DocumentDBCollection collection = DocumentDBCollection.creator( // (1)
"users", // (2)
database.getQualifiedName()) // (3)
.documentDBCollectionSchemaDefinition("{\"type\":\"object\",\"properties\":{\"name\":{\"type\":\"string\"},\"email\":{\"type\":\"string\"}}}") // (4)
.documentDBCollectionIsCapped(false) // (5)
.documentDBCollectionNumIndexes(3) // (6)
.build();
AssetMutationResponse response = collection.save(client); // (7)
  1. Build up the minimum request to create a DocumentDB collection.
  2. Provide a human-readable name for your collection.
  3. Provide the qualifiedName of the database that contains this collection.
  4. Optionally provide the schema definition for the collection.
  5. Optionally specify whether the collection is capped or not.
  6. Optionally provide additional metadata about the collection.
  7. Actually call Atlan to create the collection. Because this operation will persist the asset in Atlan, you must provide it an AtlanClient through which to connect to the tenant.

Additional collection properties

The DocumentDBCollection asset type has a number of specific properties that you can use to provide more detailed information:

  • documentDBCollectionAverageObjectSize: Average size of an object in the collection
  • documentDBCollectionExpireAfterSeconds: Seconds after which documents in a time series collection or clustered collection expire
  • documentDBCollectionMaxSize: Maximum size allowed in a capped collection
  • documentDBCollectionMaximumDocumentCount: Maximum number of documents allowed in a capped collection
  • documentDBCollectionNumOrphanDocs: Number of orphaned documents in the collection
  • documentDBCollectionSubtype: Subtype of a DocumentDB collection (for example, Capped, Time Series, etc.)
  • documentDBCollectionTimeField: Name of the field containing the date in each time series document
  • documentDBCollectionTimeGranularity: Closest match to the time span between consecutive incoming measurements
  • documentDBCollectionTotalIndexSize: Total size of all indexes

Available relationships

Each DocumentDB asset is an Asset, and can therefore be related to the following other assets.

Footnotes

  1. Note that unlike other assets, the packaged connection delete utility in the UI will not remove DocumentDB assets associated with the connection. So the DocumentDB assets themselves must be deleted, separately from the connection.

Was this page helpful?