# query-lib-vr

> This is a simple Node.js MongoDB document Query String Helper I've built. Works with: fields, page, skip limit, sort(asc/desc). Aslo enables the use of equality operators($gt, $gte, $lt, $lte). Takes in 3 parameters: qsHelper(model, req, res), returns th

Latest version **2.5.1** (published 2021-03-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install query-lib-vr
pnpm add query-lib-vr
yarn add query-lib-vr
bun add query-lib-vr
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.5.1 |
| Published | 2021-03-17 |
| First published | 2021-03-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | vasx93 |

## Links

- npm: https://www.npmjs.com/package/query-lib-vr
- npm.io page: https://npm.io/package/query-lib-vr

## Recent versions

- 2.5.1 (latest) — 2021-03-17
- 2.5.0 — 2021-03-16
- 2.4.0 — 2021-03-16
- 2.3.0 — 2021-03-16
- 2.2.0 — 2021-03-16
- 2.0.2 — 2021-03-16
- 2.0.1 — 2021-03-16
- 2.0.0 — 2021-03-16
- 1.1.0 — 2021-03-16
- 1.0.3 — 2021-03-16
- 1.0.2 — 2021-03-16
- 1.0.1 — 2021-03-16
- 1.0.0 — 2021-03-16

## README

This is a simple Node.js MongoDB document Query String Helper I've built.
Works with: fields, page, skip limit, sort(asc/desc). Aslo enables the use of equality operators($gt, $gte, $lt, $lte). Takes in 3 parameters: qsHelper(model, req, res), returns the queried documents.

Install:

Install via npm package manager
npm install query-lib-vr

Require it on the top of the file
const { qsHelper } = require('query-lib-vr')

Use:
const results = await qsHelper(Model, req, res)

Features:

Regex

Making use of equality operators >, >=, <, <= in query strings and translating so MongoDB can read them.

Output would be
my-site.com/api/products?price[gte]=199&price[lte]=499&sort=-quantity

Pagination implemented:
Default Page size display is 5

In practice:

my-site.com/api/items?sort=discount&page=1
(displays first 5 items)
Model(query).skip(0).limit(5)

my-site.com/api/items?sort=discount&page=3
(displays 3. page, skips first 15 products)

---
_Source: https://npm.io/package/query-lib-vr · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
