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

395
Visualizações
Why I cannot do sort operation in Mongodb3.4 text search

I followed the guide in the page mongo Text Search but when I build text index on my collection (about 2 million lines) and try to search some and sort by score, it returns an error:

Error: error: {
    "ok" : 0,
    "errmsg" : "Executor error during find command: OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.",
    "code" : 96,
    "codeName" : "OperationFailed"
}
over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

According to the docs, if mongoDB can't obtain the sort order via an index scan it will use an algorithm that will buffers the first k results of the query. If the memory footprint exceeds 32 megabytes, the query will fail which is what you are experiencing. Try to limit the number of scanned results by using the limit() method.

over 4 years ago · Santiago Trujillo Relatório

0

@Tristan is correct but a better solution than using limit would be to filter by the score first. By using limit you may not get the highest score in your record set.

As an example if your score was out of 100 and you were interested in high scores filter on that first before the performing the sort.

db.getCollection("myCollection").find(
  { 
    "score" : {
      "$gt" : 90
    }
  }
).sort(
  { 
    "score" : 1.0
  }
);
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