All Products
Search
Document Center

Database Autonomy Service:GetMongoDBCurrentOp

Last Updated:Mar 13, 2026

Queries the current sessions of an ApsaraDB for MongoDB (MongoDB) instance.

Operation description

  • This operation is applicable only to MongoDB instances.

  • If you use an Alibaba Cloud SDK or Database Autonomy Service (DAS) SDK to call this operation, we recommend that you use the latest version of the SDK.

  • If you use an SDK to call API operations of DAS, you must set the region to cn-shanghai.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

hdm:GetMongoDBCurrentOp

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The instance ID.

dds-uf6079bda570****

NodeId

string

No

The node ID.

Note

If you do not specify a node ID, the sessions of the primary node are queried by default.

23302531

Role

string

No

A reserved parameter. You do not need to specify the parameter.

None

FilterDoc

string

No

The db.currentOp() command that is used to filter sessions. For more information, see db.currentOp() of MongoDB Documentation.

{ "active" : true }

Response elements

Element

Type

Description

Example

object

Code

integer

The response code.

200

Message

string

The returned message.

Note

If the request was successful, Successful is returned. Otherwise, an error message such as an error code is returned.

Successful

Data

object

The details of the sessions.

Timestamp

integer

The time when the database sessions were returned. The value is in the UNIX timestamp format. Unit: milliseconds.

1692029584428

SessionList

array<object>

The sessions.

object

OpId

string

The operation ID.

14508

Active

boolean

Indicates whether the operation is active. Valid values:

  • true

  • false

true

Command

string

The document that contains the complete command object associated with the operation.

"command" : { "find" : "items", "filter" : { "sku" : 1403978 }, ... "$db" : "test" }

Op

string

The type of the operation.

update

SecsRunning

integer

The duration of the operation. Unit: seconds.

5

PlanSummary

string

The description of the execution plan.

None

Host

string

The host.

a79****.cloud.et15:3328

Client

string

The IP address of the client.

219.143.XX.XX:52324

Desc

string

The description of the connection.

conn1013858

Ns

string

The namespace.

admin.cmd

ConnectionId

integer

The connection ID.

66378736

Driver

string

The driver for MongoDB.

mongo-java-driver|legacy@3.11.2

OsType

string

The type of the operating system.

Linux

OsName

string

The name of the operating system.

Linux

OsArch

string

The architecture of the operating system.

AMD64

Platform

string

The platform.

Java/Alibaba/1.8.0_152-b5

KillPending

boolean

Indicates whether the operation is marked as terminated.

  • true

  • false

true

Shard

string

The ID of the data shard.

Note

This parameter is returned for sharded cluster instances.

d-bp1689995b78****

SessionStat

object

The statistics on the sessions.

ActiveCount

integer

The number of active sessions.

0

TotalCount

integer

The total number of sessions.

11

LongestSecsRunning

integer

The longest duration of a session. Unit: seconds.

0

ClientStats

object

The statistics on the IP addresses of the clients.

object

The details of the IP addresses of the clients.

ActiveCount

integer

The number of clients whose IP addresses are active.

0

TotalCount

integer

The total number of IP addresses of clients.

11

DbStats

object

The statistics on the namespaces.

object

The details of the namespaces.

ActiveCount

integer

The number of active namespaces.

0

TotalCount

integer

The total number of namespaces.

11

RequestId

string

The request ID.

FC6C0929-29E1-59FD-8DFE-70D9D41E****

Success

boolean

Indicates whether the request was successful. Valid values:

  • true

  • false

true

For more information, see the data returned by running the currentOp command of MongoDB.

Examples

Success response

JSON format

{
  "Code": 200,
  "Message": "Successful",
  "Data": {
    "Timestamp": 1692029584428,
    "SessionList": [
      {
        "OpId": "14508",
        "Active": true,
        "Command": "\"command\" : {\n  \"find\" : \"items\",\n  \"filter\" : {\n    \"sku\" : 1403978\n  },\n  ...\n  \"$db\" : \"test\"\n}",
        "Op": "update",
        "SecsRunning": 5,
        "PlanSummary": "None",
        "Host": "a79****.cloud.et15:3328",
        "Client": "219.143.XX.XX:52324",
        "Desc": "conn1013858",
        "Ns": "admin.cmd",
        "ConnectionId": 66378736,
        "Driver": "mongo-java-driver|legacy@3.11.2",
        "OsType": "Linux",
        "OsName": "Linux",
        "OsArch": "AMD64",
        "Platform": "Java/Alibaba/1.8.0_152-b5",
        "KillPending": true,
        "Shard": "d-bp1689995b78****"
      }
    ],
    "SessionStat": {
      "ActiveCount": 0,
      "TotalCount": 11,
      "LongestSecsRunning": 0,
      "ClientStats": {
        "key": {
          "ActiveCount": 0,
          "TotalCount": 11
        }
      },
      "DbStats": {
        "key": {
          "ActiveCount": 0,
          "TotalCount": 11
        }
      }
    }
  },
  "RequestId": "FC6C0929-29E1-59FD-8DFE-70D9D41E****",
  "Success": true
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParams The request parameters are invalid.
403 NoPermission You are not authorized to do this action.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.