i have the following models :
Appgroupmodule.js
module.exports = {
autoPK: false,
freezeTableName: true,
autoCreatedAt: false,
autoUpdatedAt: false,
attributes: {
appgroup_id:{
model: 'Appgroup'
},
appmodule_id:{
model: 'Appmodule',
primaryKey: true
},
active: 'INTEGER'
}
};
Appmodule.js
var uuid = require('node-uuid');
module.exports = {
autoPK: false,
freezeTableName: true,
autoCreatedAt: false,
autoUpdatedAt: false,
attributes: {
id: {
type : 'uuidv4',
primaryKey: true,
required: true
},
name: 'STRING',
url: 'STRING',
idx: 'INTEGER',
flag: 'INTEGER',
deleted: 'INTEGER',
uplink: 'STRING'
},
newid: function(){
return uuid.v4();
},
beforeCreate: function(values,next){
values.id = uuid.v4();
next();
}
};
and i have the following code :
Appgroupmodule.find({appgroup_id:req.session.user.appgroup_id,active:0})
.populateAll()
.sort({'idx':'asc'})
and raise an error
Details: Error: ER_BAD_FIELD_ERROR: Unknown column 'appgroupmodule.idx' in 'order clause'
How to sort by idx which idx is field of model Appmodule?