问题内容
module.exports = {
trigger: {
beforeCreate: async function(obj = {}) {
console.log('beforeCreate', obj)
obj.addDataList.create_time = Date.now()
},
afterCreate: async function(obj = {}) {
console.log('afterCreate', obj)
},
beforeUpdate: async function(obj = {}) {
console.log('beforeUpdate', obj)
obj.updateData.update_time = Date.now()
},
afterUpdate: async function(obj = {}) {
console.log('afterUpdate', obj)
}
}
}
问题原因
没有使用jql
解决方法
将
const db = uniCloud.database();
改为
const dbJql = uniCloud.databaseForJQL();