Navigation

Supported MongoDB Commands

The following MongoDB query operations are supported by Data Lake.

Important

Some commands have special behavior in Data Lake that differs from standard MongoDB functionality.

To run a command against your Data Lake, use db.runCommand():

db.runCommand( { <command> } )
Note

Atlas Data Lake doesn't include a server-side JavaScript engine. So, it doesn't support commands like mapReduce that require server-side scripting enabled.

Command
Description

The following limitation applies:

Atlas Data Lake supports the explain, cursor, comment, and background options only.

For the comment option, Atlas Data Lake supports only type string.

Atlas Data Lake supports {"background" : <boolean>} option for $out to S3 and Atlas cluster only. The background option is not available for other aggregation pipeline stages. See $out Options for more information.

Tip
See also:

The following limitations apply:

  • Atlas Data Lake converts count() to an aggregation pipeline internal to Data Lake.
  • Atlas Data Lake supports only the query option.
Command
Description

The response returns the following fields:

ok
Returns 1 for success or 0 for failure.
version
The MongoDB client compatibility version. This is the earliest version of the MongoDB client with which the Data Lake service is compatible.
versionArray
The MongoDB client compatibility version in array format.
dataLake.version
The version number of Data Lake.
dataLake.gitVersion
The git version the Data Lake service.
dataLake.date
The build timestamp of the Data Lake service.
Example
{
"ok" : <return>,
"version" : "<version-number>",
"versionArray" : [
<number>,
<number>,
<number>,
<number>
],
"dataLake" : {
"version" : "<version-number>",
"gitVersion" : "<version-number>",
"date" : "<timestamp>"
}
}

The following fields are omitted from the response:

  • count
  • avgObjSize
  • capped
  • max
  • maxSize
  • wiredTiger
  • nindexes
  • totalIndexSize
  • indexSizes

The following fields are added to the response. You can use these fields to verify what partitions are being used to populate a collection.

partitions.format
The file format of the partition.
partitions.attributes
The filtering attributes of the partition.
partitions.source
The S3 URL or Atlas cluster name, which is the backing data of the partition.
partitions.size
The size, in bytes, of the partition.
partitionCount
The number of partitions.
avgPartitionSize
The average size of all paritions.
Example
{
...
"partitions": [{
"format": <file format>,
"attributes": <filtering attributes>,
"source": <S3 url or Atlas cluster name>,
"size": <size, in bytes, of the partition>
}, ...],
"partitionCount": <number of partitions>,
"avgPartitionSize": <average size of all partitions>
...
}

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 Data Lake at any given time. If a user authenticates and then runs the db.auth() command, Data Lake replaces previous user's permissions with the new user's permissions.

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

The following fields are omitted from the response:

  • object
  • avgObjSize
  • fsUsedSize
  • fsTotalSize

The data returned by explain documents the Data Lake query plan, and differs from MongoDB in that it provides information about the data partitions used to satisfy the query.

The following commands are explainable in Data Lake:

  • aggregate()
  • count()
  • find()

The following verbosity modes are supported:

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

The executionStats and allPlansExecution modes are not supported.

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 response returns successfully, but includes no log data.
The MaxTimeMS option is not supported.

The reponse returns 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" : {
},
}
Tests whether a server is responding to commands.
Returns the client IP address.
Command
Description

The following options are supported:

  • batchSize
  • singleBatch
  • filter
  • limit
  • projection
  • skip
  • sort

find() is converted to an aggregation pipeline internal to the Data Lake.

Command
Description
Data Lake uses SCRAM-SHA authentication.
Command
Description

The response always returns a document in which isMaster: true. It also returns operational parameters.

The optional saslSupportedMechs field set to the <db.user> is supported.

Note
About the hello Command

Atlas Data Lake also supports the hello command, which is an alias for the isMaster command. The hello command returns a document that is identical to the document returned by the isMaster command. In the document returned by the hello command, the isWritablePrimary field is set to true instead of the isMaster field. We recommend the hello command instead of isMaster.

Command
Description
Kills the specified cursor or cursors for a collection.

Retrieves information about the collections in a database, such as collection names and options. The response contains information that can be used to create a cursor to the collection information.

The following options are supported:

  • filter (Exact match only.)
  • nameOnly
  • authorizedCollections

Provides a list of all existing databases. You must use the admin database to run the listDatabases command.

The following options are supported:

  • filter (Exact match only.)
  • nameOnly
  • authorizedDatabases

listDatabases always returns sizeOnDisk: 0 and empty: false so it can return quickly, without scanning all the files in the Data Lake.

Command
Description
Returns inheritance and privilege information for specified roles.
Command
Description

Returns information about one or more users.

The forAllDBs argument is not supported.

Command
Description
storageGetConfig

Returns the current Data Lake configuration. For complete documentation on the configuration document format, see Configuration Document Format.

db.runCommand( { "storageGetConfig" : 1 } )

To learn more about this command, see Retrieve Data Lake Configuration.

storageSetConfig

Replaces the current Data Lake configuration with a JSON document. For complete documentation on the configuration document format, see Configuration Document Format.

db.runCommand( { "storageSetConfig" : <config> } )

To learn more about this command, see Set or Update Data Lake Configuration.

storageGenerateConfig

Generates a configuration for your Data Lake in JSON format. For complete documentation on the configuration document format, see Configuration Document Format.

db.runCommand( { "storageGenerateConfig" : 1 } )

To learn more about this command, see Generate Data Lake Configuration.

storageValidateConfig

Validates the given Data Lake configuration. For complete documentation on the configuration document format, see Configuration Document Format.

db.runCommand( { "storageValidateConfig" : <config> } )

To learn more about this command, see Validate Data Lake Configuration.

Give Feedback

On this page