Make sure invalid fields are filtered out
This commit is contained in:
parent
da64cea7c4
commit
2cb0f5280a
|
@ -914,8 +914,10 @@ SQLConnector.prototype.buildColumnNames = function(model, filter) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var keys = Object.keys(cols);
|
var keys = Object.keys(cols);
|
||||||
if (Array.isArray(fieldsFilter) && fieldsFilter.length > 0) {
|
if (Array.isArray(fieldsFilter) && fieldsFilter.length > 0) {
|
||||||
// No empty array, including all the fields
|
// Not empty array, including all the fields that are valid properties
|
||||||
keys = fieldsFilter;
|
keys = fieldsFilter.filter(function(f) {
|
||||||
|
return cols[f];
|
||||||
|
});
|
||||||
} else if ('object' === typeof fieldsFilter &&
|
} else if ('object' === typeof fieldsFilter &&
|
||||||
Object.keys(fieldsFilter).length > 0) {
|
Object.keys(fieldsFilter).length > 0) {
|
||||||
// { field1: boolean, field2: boolean ... }
|
// { field1: boolean, field2: boolean ... }
|
||||||
|
|
Loading…
Reference in New Issue