Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

400
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda