ag-grid-mongo-query-builder
Advanced tools
Comparing version 0.4.0 to 0.4.1
{ | ||
"name": "ag-grid-mongo-query-builder", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "Utility to generate Mongo DB aggregation pipeline queries starting from AgGrid server side params", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -35,3 +35,3 @@ //const mongoose = require('mongoose'); | ||
const filterQuery = isFiltering ? buildFilterQuery(filterModel) : []; | ||
const filterQuery = isFiltering ? buildFilterQuery(filterModel, isGrouping) : []; | ||
const quickSearchQuery = isQuickSearch && quickFilter ? buildQuickSearchQuery(column, quickFilter) : []; | ||
@@ -113,3 +113,3 @@ const flagSearchQuery = isFlagSearch && flagFilters.length >0 ? buildFlagQuery(flagColumns, flagFilters) : []; | ||
const filterQuery = isFiltering ? buildFilterQuery(filterModel) : []; | ||
const filterQuery = isFiltering ? buildFilterQuery(filterModel, isGrouping) : []; | ||
const quickSearchQuery = isQuickSearch && quickFilter ? buildQuickSearchQuery(column, quickFilter) : []; | ||
@@ -160,9 +160,11 @@ const flagSearchQuery = isFlagSearch && flagFilters.length >0 ? buildFlagQuery(flagColumns, flagFilters) : []; | ||
function buildFilterQuery(filterModel) { | ||
function buildFilterQuery(filterModel, isGrouping) { | ||
const columns = Object.keys(filterModel); | ||
const addFieldArr = []; | ||
const query = columns.map(column => { | ||
const addFieldObj = { $addFields: { }}; | ||
addFieldObj.$addFields[`${column}Type`] = { $type: `$${column}` }; | ||
addFieldArr.push(addFieldObj); | ||
if(isGrouping) { | ||
const addFieldObj = { $addFields: { }}; | ||
addFieldObj.$addFields[`${column}Type`] = { $type: `$${column}` }; | ||
addFieldArr.push(addFieldObj); | ||
} | ||
return buildColumnQuery(filterModel[column], column) | ||
@@ -169,0 +171,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44882
946