Docs Menu
Docs Home
/
MongoDB Atlas
/ / /

Diagnostic Commands

On this page

  • buildInfo
  • collStats
  • connectionStatus
  • dbStats
  • explain
  • Usage
  • Output
  • getLog
  • getMore
  • hostInfo
  • ping
  • whatsmyuri

For the buildInfo command, the response contains the following fields:

Field
Description
ok
Returns 1 for success or 0 for failure.
version
MongoDB client compatibility version. This is the earliest version of the MongoDB client with which the Data Federation service is compatible.
versionArray
MongoDB client compatibility version in array format.
dataLake.version
Version number of Data Federation.
dataLake.gitVersion
Git version of the Data Federation service.
dataLake.date
Build timestamp of the Data Federation service.
dataLake.mongoSQLVersion
mongoSQL version of the Data Federation service.

Example

{
"ok" : <return>,
"version" : "<version-number>",
"versionArray" : [
<number>,
<number>,
<number>,
<number>
],
"dataLake" : {
"version" : "<version-number>",
"gitVersion" : "<version-number>",
"date" : "<timestamp>",
"mongoSQLVersion" : "<version-number>"
}
}

For the collStats command, Atlas Data Federation omits the following fields in the response:

  • avgObjSize

  • capped

  • max

  • maxSize

  • wiredTiger

  • nindexes

  • totalIndexSize

  • indexSizes

Atlas Data Federation includes the following fields in the response. You can use these fields to verify what partitions are used to populate a collection, understand how recently the stats were computed, and determine if Atlas Data Federation truncated the output document.

Field
Description
dataLake.partitionCount
Number of partitions.
dataLake.avgPartitionSize
Average size of all partitions.
dataLake.partitions.format
File format of the partition.
dataLake.partitions.attributes
Filtering attributes of the partition.
dataLake.partitions.count
Number of documents in the partition.
dataLake.partitions.size
Size, in bytes, of the partition.
dataLake.partitions.source
Cloud storage URL, which contains the backing data of the partition.
dataLake.partitions.version

MongoDB version of the Atlas cluster. The collStats command returns this only for Atlas Cluster data stores. The value has the following format:

<major-version-number>.<minor-version-number>.<patch-version-number>

For example, 7.0.1.

cacheMetadata
Information about how recently Atlas Data Federation computed the statistics.
cacheMetadata.computeTime
Time in ISODate format when the computation for the stats started.
cacheMetadata.automaticRefreshInProgress
Flag that indicates whether a background job is running now to refresh the cache.
truncated

Flag that indicates whether Atlas Data Federation enforced the maximum document size limit of 16MiB. The flag value can be one of the following:

  • true - if the output document size exceeded the limit and was therefore truncated to include only enough partitions that allowed the document to comply with the size limit. If true, the partitionCount and avgPartitionSize values that Atlas Data Federation returns may be smaller than the actual values.

  • false - if Atlas Data Federation returns the entire document.

Example

{
...
"partitionCount": <number of partitions>,
"avgPartitionSize": <average size of all partitions>,
"partitions": [
{
"format": <file format>,
"attributes": <filtering attributes>,
"count": <number of documents in partition>,
"source": <cloud storage URL>,
"size": <size, in bytes, of the partition>
},
...
],
"truncated": false,
"cacheMetadata": {
computeTime: ISODate("2021-07-25T15:10:33.513Z"),
automaticRefreshInProgress: false
},
...
}

Atlas Data Federation introduces an optional boolean parameter, sync, to bypass the cache and fetch the most recent storage statistics for a given collection. The following values are valid for the sync parameter:

  • true - to bypass the cache and return the most recent storage statistics

  • false - to return cached data

If the sync parameter is omitted, defaults to false.

Example

db.runCommand( {collStats: "<string>", sync: true|false} )

To learn more about the parameters supported by this command, see collStats.

For connectionStatus command, Atlas Data Federation returns information about the current connection, specifically the state of authenticated users and their available roles.

Note

Only one user can authenticate on a connection to a federated database instance at any given time. If a user authenticates and then runs the db.auth() command, Data Federation replaces the previous user's permissions with the new user's permissions.

The connectionStatus command shows only the newly authenticated user in the authenticatedUsers output field.

For dbStats command, Atlas Data Federation introduces an optional boolean parameter, sync, to bypass the cache and fetch the most recent storage statistics for a given database. The following values are valid for the sync parameter:

  • true - to bypass the cache and return the most recent storage statistics

  • false - to use the cached data also

If the sync parameter is omitted, defaults to false.

Example

db.runCommand( {dbStats: 1, sync: true|false} )

To learn more about the parameters supported by this command, see dbStats.

Atlas Data Federation command omits the followig fields in the response:

  • object

  • avgObjSize

  • fsUsedSize

  • fsTotalSize

The commands adds the following fields in the response. You can use these fields to determine whether the command returned stale data.

Field
Description
cacheMetadata
Contains information on how recently the stats were computed.
cacheMetadata.computeTime
Time in ISODate format when the computation for the stats started.
cacheMetadata.automaticRefreshInProgress
Flag that indicates whether a background job is running now to refresh the cache.

The explain command returns information that describes the Data Federation query plan. The explain output differs from MongoDB in that it provides information about the data partitions used to satisfy the query.

The following commands can be explained in Data Federation:

  • aggregate()

  • count()

  • find()

Atlas Data Federation supports the following verbosity modes:

  • queryPlanner - provides information on the query plan. If the verbosity is not specified, Atlas Data Federation defaults to this mode.

  • queryPlannerExtended - provides detailed information on the query plan including information about the object-storage objects, such as the object-storage object names and sizes that will be queried.

  • executionStats - provides query execution statistics and performance.

Atlas Data Federation doesn't support the allPlansExecution mode.

Example

The following example shows how to use the explain command to get information about the aggregate command, including detailed information on the query plan.

db.runCommand({ "explain": { "aggregate": "user", "verbosity":
"queryPlannerExtended", "pipeline": [ ], "cursor": {} }})

The following example shows how to append a method to the explain method, such as the find() method, to get query execution statistics on the query.

db.users.explain("executionStats").find({"type": "admin"})

When you run explain, Atlas Data Federation returns the following additional fields for other partitions:

Output Field Name
Description
stats
Document that describes the number and total size of partitions that Atlas Data Federation might open for the query.
stats.size
Total size of partitions that Atlas Data Federation might open for the query.
stats.numberOfPartitions
Number of partitions that Atlas Data Federation might open for the query.
truncated
Boolean that indicates whether the explain output is truncated. The explain total output document size is limited to 16 MiB.
plan
Document that contains the query execution plan for the query. The document contains nested execution plan nodes, each of which is a document describing the plan node. The nested plan node documents contain internal description of Atlas Data Federation's query execution, and include various node kinds that are subject to change. Contact MongoDB support if you need more help with understanding the query plan.

In the queryPlanner mode, the results returned by explain provide detailed information on the partitions in the federated database instance.

Example Output
1{
2 ok: 1,
3 stats: { size: '66 B', numberOfPartitions: 2 },
4 truncated: false,
5 plan: {
6 kind: 'region',
7 region: 'aws/us-east-1',
8 node: {
9 kind: 'data',
10 size: '66 B',
11 numberOfPartitions: 2,
12 partitionsTruncated: false,
13 partitions: [
14 {
15 source: 'projectID:cluster',
16 provider: 'atlas',
17 size: '4 B',
18 database: 'locations',
19 collection: 'nyc'
20 },
21 {
22 source: 'dls:projectID',
23 provider: 'dls:aws',
24 size: '62 B',
25 metadataLocation: { provider: 'aws', region: 'us-east-1' },
26 dataSetName: 'v1$atlas$archive$etc',
27 optimizationPlan: { kind: 'everything' }
28 }
29 ]
30 }
31 }
32}

The explain command returns the following additional fields for Atlas partitions:

Output
Description
database
Database that that Atlas Data Federation queried.
collection
Collection that that Atlas Data Federation queried.
pipeline
Aggregation pipeline that Atlas Data Federation executed.

The explain command returns the following additional field for Online Archive partitions:

Output Field Name
Description
optimizationPlan
Details on Online Archive optimizations. Queries will likely be optimized when they contain fields that match the configured partition keys for an Online Archive.

In the queryPlannerExtended mode, the results returned by explain provide extended query planning information for partition types.

Example Output
1{
2 ok: 1,
3 stats: { size: '66 B', numberOfPartitions: 2 },
4 truncated: false,
5 plan: {
6 kind: 'region',
7 region: 'aws/us-east-1',
8 node: {
9 kind: 'data',
10 size: '66 B',
11 numberOfPartitions: 2,
12 partitionsTruncated: false,
13 partitions: [
14 {
15 source:'projectID:cluster',
16 provider: 'atlas',
17 size: '4 B',
18 database: 'locations',
19 collection: 'nyc'
20 },
21 {
22 source: 'dls:projectID',
23 provider: 'dls:aws',
24 size: '62 B',
25 metadataLocation: { provider: 'aws', region: 'us-east-1' },
26 dataSetName: 'v1$atlas$archive$etc',
27 scannedDataSetPartitionsCount: 1,
28 percentOfTotalPartitions: 100,
29 optimizationPlan: { kind: 'everything' }
30 },
31 ]
32 }
33 }
34}

The explain command returns all the information from queryPlanner and the following additional fields for Online Archive partitions:

Output Field Name
Description
scannedDataSetPartitionsCount
Number of partitions scanned to complete the query.
percentOfTotalPartitions
Percentage of partitions scanned over the total number of partitions.

In the executionStats mode, the results returned by explain provide information on query execution statistics and performance for only Atlas partitions. These are obtained by executing an executionStats explain command on the Atlas partition's underlying Atlas collection. For non-Atlas partitions, explain returns the queryPlanner information. The partitions field in the results include an additional explainResults field, which is a document that might contain the following fields:

Output Field Name
Description
executionStats
Provides information about the execution of the Atlas cluster's winning query plan, including the number of documents and keys examined.
queryPlanner
Contains information about Atlas cluster's query plan selection, including index selection.
stages
Includes breakdown of pipeline stages and statistics on a per stage basis.

Note

To learn more about these fields, see executionStats.

Example Output
1{
2 ok: 1,
3 stats: { size: '66 B', numberOfPartitions: 2 },
4 truncated: false,
5 plan: {
6 kind: 'region',
7 region: 'aws/us-east-1',
8 node: {
9 kind: 'data',
10 size: '66 B',
11 numberOfPartitions: 2,
12 partitionsTruncated: false,
13 partitions: [
14 {
15 source: 'projectID:cluster',
16 provider: 'atlas',
17 size: '4 B',
18 database: 'locations',
19 collection: 'nyc',
20 explainResults: {
21 queryPlanner: {
22 ...
23 winningPlan: {
24 ...
25 },
26 rejectedPlans: []
27 },
28 executionStats: {
29 ...
30 },
31 stages: {
32 ...
33 }
34 }
35 },
36 {
37 source: 'dls:projectID',
38 provider: 'dls:aws',
39 size: '62 B',
40 metadataLocation: { provider: 'aws', region: 'us-east-1' },
41 dataSetName: 'v1$atlas$archive$etc'
42 },
43 ]
44 }
45 }
46}

For getLog command, Atlas Data Federation returns a successful response, but doesn't includes log data.

For getMore command, Atlas Data Federation returns subsequent batches of documents currently pointed to by a cursor, when used in conjunction with commands that return a cursor, e.g. find and aggregate.

For hostInfo command, Atlas Data Federation returns only the following subset of fields from the standard MongoDB response:

{
"ok" : <return>,
"system" : {
"currentTime" : ISODate("<timestamp>"),
"hostname" : "<hostname>",
"cpuAddrSize" : <number>,
"memSizeMB" : <number>,
"numCores" : <number>,
"cpuArch" : "<identifier>",
},
"os" : {
"type" : "<string>",
"name" : "<string>",
},
"extra" : { }
}

For ping command, Atlas Data Federation tests whether a server is responding to commands.

For whatsmyuri command, Atlas Data Federation returns the client IP address.

Back

Administration