How to use the mongo-cursor-pagination.find function in mongo-cursor-pagination

To help you get started, we’ve selected a few mongo-cursor-pagination examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NRCan / energuide_api / api / src / schema / resolvers.js View on Github external
}
            // We are evaling our own code here, not user input.
            // Filter.field is our code, stringified and stored in an enum.
            // The user choses one of the enum values and we convert the string
            // back to a function which accepts a matcher and generates the
            // query we need to find that field.
            // eslint-disable-next-line security/detect-eval-with-expression
            let queryGenerator = eval(filter.field) // eslint-disable-line no-eval
            let attrQuery = queryGenerator({
              [filter.comparator]: value,
            })
            query['$and'].push(attrQuery)
          })
        }

        let result = await MongoPaging.find(client, {
          query,
          next,
          previous,
          limit,
        })

        return result
      },
    },

mongo-cursor-pagination

Make it easy to return cursor-paginated results from a Mongo collection

MIT
Latest version published 1 year ago

Package Health Score

60 / 100
Full package analysis