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

111
Vistas
Cursor style limit on sorted items given an ObjectID in Mongo

I have a set of fields with variable match and sort criteria, i.e. a Smart Query. I run an aggregation that matches and sorts, but I'd like to implement a cursor style pagination. For my normal lists I can use a greater than the order field of a ObjectID passed into my API, but Smart Queries won't have a hard coded order field.

How can I use an ObjectID to get the next (n) number of items in a list that I've already matched and sorted. Using javascript and mongoose here's some general code for my current query

const plist = await Media.aggregate([
          ...smartMatch,
          ...smartSort,
          //somehow match and limit next (n) items after ObjectID,
        ]).allowDiskUse(true);

Smart Match and Sort being an array of operations defined by the user.

about 4 years ago · Juan Pablo Isaza
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