Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

175
Visualizações
Mongodb changestream pipeline query does not work

My document is like this:

{
    "_id": {
        "$oid": "6257a55d04bf2167733f5b72"
    },
    "attributes": {
        "CustomerName": "John",
        "CustomerID": "28374",
        "LoanID": "82349327409234"
    },
    "type": "Record"
}

My changestream watch is like this:

var watchCursor = db.transactions.watch([ {$match: {"attributes.LoanID": { $exists : true }}} ]);
while (!watchCursor.isExhausted()){
   if (watchCursor.hasNext()){
      print(JSON.stringify(watchCursor.next()));
   }
}

But the change stream can't find this document. Any thoughts? Note that my search query is after the nested field inside attributes.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Ah the reason is because the changestream event document is not an exact copy of the actual document.

In case of an update, the actual document resides in updateDescription.updatedFields and in case of an insert it resides in fullDocument field.

Ref: Mongodb change-events

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda