pegue mais
Definição
Compatibilidade
Esse comando está disponível em implantações hospedadas nos seguintes ambientes:
MongoDB Atlas: o serviço totalmente gerenciado para implantações do MongoDB na nuvem
Observação
Este comando é aceito em todos os clusters do MongoDB Atlas. Para obter informações sobre o suporte do Atlas a todos os comandos, consulte Comandos não suportados.
MongoDB Enterprise: a versão autogerenciada e baseada em assinatura do MongoDB
MongoDB Community: uma versão com código disponível, de uso gratuito e autogerenciada do MongoDB
Sintaxe
O comando tem a seguinte sintaxe:
db.runCommand( { getMore: <long>, collection: <string>, batchSize: <int>, maxTimeMS: <int>, comment: <any> } )
Campos de comando
O comando aceita os seguintes campos:
Campo | Tipo | Descrição |
---|---|---|
| long | The cursor identifier. |
| string | The name of the collection over which the cursor is operating. |
| positive integer | Optional. The number of documents to return in the batch. If |
| non-negative integer | Opcional. Specifies the maximum time for the server to wait for new documents
that match a cursor tailable
query on a Capped Collection.
MongoDB terminates operations that exceed their allotted time limit
using the same mechanism as
|
| any | Opcional. Um comentário fornecido pelo usuário para anexar a este comando. Depois de definido, esse comentário aparece junto com os registros desse comando nos seguintes locais:
Um comentário pode ser qualquer tipo BSON válido (string, inteiro, objeto, array etc). If omitted, |
Saída
The command returns a document that contains the cursor information as well as the next batch.
For example, running getMore
on a cursor created by a
find
operation on a sharded cluster returns a document
similar to this output:
{ "cursor" : { "id" : NumberLong("678960441858272731"), "ns" : "test.contacts", "nextBatch" : [ { "_id" : ObjectId("5e8e501e1a32d227f9085857"), "zipcode" : "220000" } ], "partialResultsReturned" : true, "postBatchResumeToken": "< Resume Token >" }, "ok" : 1, "operationTime" : Timestamp(1586385239, 2), "$clusterTime" : { "clusterTime" : Timestamp(1586385239, 2), "signature" : { "hash" : BinData(0,"lLjejeW6AQGReR9x1PD8xU+tP+A="), "keyId" : NumberLong("6813467763969884181") } } }
Campo | Descrição |
---|---|
| Contains the cursor information, including the
cursor ID as well as the Se The |
| Indica se o comando foi bem-sucedido ( |
In addition to these fields, the db.runCommand()
response
includes the following information for replica sets and sharded
clusters:
$clusterTime
operationTime
See db.runCommand() Response for details.
Comportamento
Controle de acesso
If Autenticação is enabled, you can
only run getMore
against cursors you created.
Sessões
For cursors created inside a session, you cannot call
getMore
outside the session.
Similarly, for cursors created outside of a session, you cannot call
getMore
inside a session.
Transações
Queries lentas
Starting in MongoDB 5.1, when a getMore
command is logged
as a slow query, the queryHash and planCacheKey fields are added
to the slow query log message and the
profiler log message.
A partir do MongoDB 8.0, o campo queryHash
existente é duplicado em um novo campo chamado planCacheShapeHash
. Se você estiver usando uma versão anterior do MongoDB , verá apenas o campo queryHash
. As futuras versões do MongoDB removerão o campo queryHash
obsoleto, e você precisará usar o campo planCacheShapeHash
em seu lugar.