I have a problem with REST parallel queries. In my function I use code like
const res = col.query(‘SELECT data, meta().cas FROM test WHERE meta().id = “123”’);
const doc = res.rows[0];
doc.data[req.params,type] = {“position”: req.params.position};
col.upsert(‘123’, doc, {cas: doc.cas});
But if many users tried to send data to same ID , data do not saving OR some time cas mismatch error
What is best practice to upsert to one document from many queries?