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

116
Visualizações
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 à 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