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

629
Visualizações
Mongo "Unrecognized pipeline stage name: '$filter'"

I'm trying to execute following query in latest mongo 3.4.1 server and the 3.4.1 shell.

db.dealer.aggregate(
[
{$match:{salesAreaId:{$in:[ObjectId("5858d03ec5109a098c854802")]}}},
{$lookup:{
    from:"outstanding",
    localField:"_id",
    foreignField:"dealer_id",
    as:"outstandings"
    }},
 {$filter:{
     input:"$outstandings",
     as:"outstandings",
     cond:{
         $is:{"$$outstandings.finalized":false}
         }
     }}
]
)

But it says

Error: command failed: {
"ok" : 0,
"errmsg" : "Unrecognized pipeline stage name: '$filter'",
"code" : 40324,
"codeName" : "Location40324"
} : aggregate failed :
_getErrorWithCode@src/mongo/shell/utils.js:23:13
doassert@src/mongo/shell/assert.js:13:14
assert.commandWorked@src/mongo/shell/assert.js:266:5
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1215:5
@(shell):1:1

According to the documentation $filter is supporting from v3.2 onward. Any help.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Replace the below code

db.dealer.aggregate(
[
{$match:{salesAreaId:{$in:[ObjectId("5858d03ec5109a098c854802")]}}},
{$lookup:{
    from:"outstanding",
    localField:"_id",
    foreignField:"dealer_id",
    as:"outstandings"
    }},
 {$project:{
     outstandings:{$filter:{
     input:"$outstandings",
     as:"outstandings",
     cond:{
         $is:{"$$outstandings.finalized":false}
         }
     }
     }
     }
 }
])

over 4 years ago · Santiago Trujillo 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