Open rathapolk opened 8 years ago
I have this model ..
db.define('schoolSettings', { id: { type: 'text', size: 36, key: true, mapsTo: 'id' }, schoolId: { type: 'text', size: 36, required: true, mapsTo: 'school_id' }, ordering: { type: 'integer', required: true, mapsTo: 'ordering' }, settingName: { type: 'text', size: 20, required: true, mapsTo: 'setting_name' }, settingValue: { type: 'text', size: 500, mapsTo: 'setting_value' } }, { collection: 'school_settings' });
I wrote aggregate code this way...
SchoolSettings.aggregate({ schoolId: id }).max('ordering').get(function (err, max) { console.log(max); }
It prints 'undefined' which is incorrect since there are data rows in the database.
Later, I changed the model's property name 'schoolId' to actual column name in database 'school_id'. Then It works.
SchoolSettings.aggregate({ school_id: id }).max('ordering').get(function (err, max) { console.log(max); }
Should this function take model's property names instead of actual column names?
Regards, Rathapol K.
Yes, it's a bug.
I have this model ..
I wrote aggregate code this way...
It prints 'undefined' which is incorrect since there are data rows in the database.
Later, I changed the model's property name 'schoolId' to actual column name in database 'school_id'. Then It works.
Should this function take model's property names instead of actual column names?
Regards, Rathapol K.