我尝试为某些模型生成唯一标识符,但是如果我从客户端向API发送两个或多个CREATE请求,则最终会获得相同的ID
`
Model.observe('before save', function(
ctx, next) {
Model.find({
where: {
parentId: parentId
}
}, limit: 1, order:
'numberIndex DESC'
},
function(err, res) {
let idx = res[0].numberIndex + 1;
ctx.instance['identifier'] = 'SomePrefix' + idx;
ctx.instance['numberIndex'] =idx;
next()
})
})
`