adonis-lucid-mongodb
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"scripts": { | ||
@@ -11,0 +11,0 @@ "lint": "standard", |
@@ -725,3 +725,3 @@ 'use strict' | ||
target.modelQueryBuilder[key](queries) | ||
} else if (_.isObject(conditions)) { | ||
} else if (_.isPlainObject(conditions)) { | ||
_.forEach(conditions, (c, k) => { | ||
@@ -772,6 +772,7 @@ if (!_.isFunction(target.modelQueryBuilder[k])) { | ||
debug('max', target.HostModel.collection, $match, $group) | ||
connection.collection(target.HostModel.collection).aggregate([{$match}, {$group}], (err, result) => { | ||
if (err) reject(err) | ||
resolve(groupBy ? result : result[0].max) | ||
}) | ||
connection.collection(target.HostModel.collection) | ||
.aggregate([{$match}, {$group}], (err, result) => { | ||
if (err) reject(err) | ||
resolve(groupBy ? result : (_.isEmpty(result) ? null : result[0].max)) | ||
}) | ||
}) | ||
@@ -802,3 +803,3 @@ } | ||
if (err) reject(err) | ||
resolve(groupBy ? result : result[0].min) | ||
resolve(groupBy ? result : (_.isEmpty(result) ? null : result[0].min)) | ||
}) | ||
@@ -830,3 +831,3 @@ }) | ||
if (err) reject(err) | ||
resolve(groupBy ? result : result[0].sum) | ||
resolve(groupBy ? result : (_.isEmpty(result) ? 0 : result[0].max)) | ||
}) | ||
@@ -858,3 +859,3 @@ }) | ||
if (err) reject(err) | ||
resolve(groupBy ? result : result[0].avg) | ||
resolve(groupBy ? result : (_.isEmpty(result) ? null : result[0].avg)) | ||
}) | ||
@@ -861,0 +862,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
228680
8163