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

278
Vistas
Unrecognized parameter to $filter: limit MongoDB-Mongoose

I have the following error on my console:: Invalid $project :: caused by :: Unrecognized parameter to $filter: limit

The irony of this is that the documentation tells us that it exists and can be used.

This is my code

const docWorker = await _worker.aggregate([
    {
      $project: {
        credencial: {
          $cond: {
            if: {
              $eq: [{ $size: "$identificacionObra" }, 0],
            },
            then: false,
            else: {
              $cond: {
                if: {
                  $gte: [
                    {
                      $size: {
                        $filter: {
                          input: "$identificacionObra",
                          cond: {
                            $eq: ["$$credencial.estado", true],
                          },
                          as: "credencial",
                          limit: 1,  <--------- the limit parameter does not work
                        },
                      },
                    },
                    1,
                  ],
                },
                then: true,
                else: false,
              },
            },
          },
        },
      },
    },
    { $match: _match },
    { $sort: _sort },
    {
      $facet: {
        paginatedResults: [
          { $skip: req.query.page * req.query.limit - req.query.limit },
          { $limit: parseInt(req.query.limit) },
        ],
        totalCount: [
          {
            $count: "count",
          },
        ],
      },
    },
  ]);

Please help me, what did I do wrong?

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