Para agentes de IA: um índice de documentação está disponível em https://www.mongodb.com/pt-br/docs/llms.txt — as versões de markdown de todas as páginas estão disponíveis anexando .md a qualquer caminho de URL.
Menu Docs

Determinar o status da query em relação à instância do banco de dados federado

You can determine the status of a running query using $currentOp (aggregation). To run $currentOp, use the db.aggregate() helper.

Observação

If you are an Admin user, you can view all queries using the $currentOp allUsers option.

$currentOp must be run against the admin database.

Observação

If your aggregation pipeline only contains the $currentOp stage, Atlas Data Federation doesn't enforce the limit on the maximum number of simultaneous queries. You can run queries that only contain the $currentOp stage even after you reach the maximum number of simultaneous queries.

db.aggregate([{$currentOp: {} }])

$currentOp retorna documentos com os seguintes campos:

Campo
Tipo
Descrição

$currentOp.type

string

Tipo de operação. O valor é sempre op.

$currentOp.opid

Unique identifier of the operation in ObjectId format. The field value is the same as the correlationID that you can see in errors and logs.

$currentOp.client

string

Endereço IP (ou nome do host) e a porta efêmera da conexão do cliente onde a operação se origina.

$currentOp.clientMetadata

Documento

Informações adicionais do cliente, como o cliente:

  • Nome do aplicativo

  • Nome e versão do driver

  • Nome, tipo, arquitetura e versão do sistema operacional

$currentOp.active

booleano

Especifica se a operação foi iniciada. O valor é true se a operação foi iniciada ou concluída e false se a operação está ociosa.

$currentOp.currentOpTime

Hora de início da operação.

$currentOp.ns

string

Namespace that the operation targets. A namespace consists of the database name and the collection name concatenated with a dot (.); that is, "<database>.<collection>".

$currentOp.command

Documento

Um documento contendo o objeto de comando associado a esta operação.

$currentOp.msg

string

Uma mensagem que descreve o status e progresso da operação.

$currentOp.progress

Documento

Um documento que contém a quantidade de trabalho feito para a operação.

$currentOp.progress.workDone

inteiro

Um número que aumenta à medida que os documentos passam pelo pipeline, indicando que foi feito progresso em relação à conclusão da query. Esse número não é uma porcentagem e não pode ser usado para estimar quanto trabalho resta.

No exemplo abaixo, suponha que uma das seguintes queries esteja sendo executada na collection airbnb no banco de dados sample descrita no tutorial de Introdução.

db.airbnb.find( { "address.market" : "Porto", "review_scores.review_scores_rating": {$gt: 79}}).comment("Find properties in Porto")

O exemplo a seguir retorna informações sobre a query anterior em execução na collection airbnb no reconhecimento de data center sample :

db.aggregate([{$currentOp: {} }])

$currentOp returns the following documents. The workDone field shows that 770 documents had been processed at the time that $currentOp was run.

{
"type" : "op",
"opid" : ObjectId("1635fa35bf73f4320c6f99d0"),
"client" : "73.231.201.205:62351",
"clientMetadata" : {
"application" : {
"name" : "MongoDB Shell"
},
"driver" : {
"name" : "MongoDB Internal Client",
"version" : "4.2.0"
},
"os" : {
"type" : "Darwin",
"name" : "Mac OS X",
"architecture" : "x86_64",
"version" : "18.7.0"
}
},
"active" : true,
"currentOpTime" : ISODate("2020-03-26T12:51:43.291Z"),
"ns" : "sample.airbnb",
"command" : {
"find" : "airbnb",
"filter" : {
"address.market" : "Porto",
"review_scores.review_scores_rating" : {
"$gt" : 79
}
},
"comment" : "Find properties in Porto",
"lsid" : {
"id" : UUID("2211f8ac-56b2-4ba4-bb0c-2e5dd5b7cc21")
},
"$db" : "sample"
},
"msg" : "work done: 770",
"progress" : {
"workDone" : 770
}
}
{
"type" : "op",
"client" : "73.231.201.205:62353",
"clientMetadata" : {
"application" : {
"name" : "MongoDB Shell"
},
"driver" : {
"name" : "MongoDB Internal Client",
"version" : "4.2.0"
},
"os" : {
"type" : "Darwin",
"name" : "Mac OS X",
"architecture" : "x86_64",
"version" : "18.7.0"
}
},
"active" : true,
"currentOpTime" : ISODate("2020-03-26T12:51:47.380Z"),
"ns" : "admin.$cmd.aggregate",
"command" : {
"aggregate" : 1,
"pipeline" : [
{
"$currentOp" : {
}
}
],
"cursor" : {
},
"lsid" : {
"id" : UUID("045ea383-65d7-4e88-a989-37b7a8da23bc")
},
"$db" : "admin"
},
"msg" : "work done: 0",
"progress" : {
"workDone" : 0
}
}
Avalie esta página