Skip to content

dbrunonascimento/ez-query-builder-mongo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QueryBuilder

Install

run yarn add --dev ez-query-builder-mongo or npm i --save-dev ez-query-builder-mongo

How to use

Input

import { queryBuilder } from "ez-query-builder-mongo";

const params = {
	_or: [
		{ _and: [{ name:  "Eder" }, { age_in: [22,  23] }] },
		{ _and: [{ name:  "Zadravec" }, { age_in: [22,  23] }] }
	]
};

queryBuilder(params)

Output

{
	$or: [
		{
			$and: [
				{ name: "Eder" },
				{
					age: {
						$in: [22,  23]
					}
				}
			]
		},
		{
			$and: [
				{ name: "Zadravec" },
				{
					age: {
						$in: [22,  23]
					}
				}
			]
		}
	],
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%