Problems to Update data in one document aget INSERT

I need to update one document after Insert . for these purposes I have to make three requests

await collCms.query("INSERT... ");
await collCms.query("update ... ");
await collCms.query("update ... ");

But only one or to update are performed in random order

How can I separate couchbase requests in sdk nodejs?

@Lenty_Me I don’t have your code so I am not sure what update operations are you performing that you are using n1ql query.
First recommendation would be to use a KV Operation if possible.

Understand that may not be the best fit for your use case, so I am assuming looking at your example you are doing an Update immediately after Insert is that correct ?

Remember n1ql Indexes are eventually consistent, you will have to pass in a consistency option as Request Plus to immediately get access to the updated document.

You don’t need multiple updates here, what you are doing here is buying time for the Indexes to catch up and thats why you see the updates performed in random order .

Hope this helps !

Thank you very much , scale Consistency: ‘request_plus’ it is working !
it’s a pity that the documentation does not explain such points

Documentation is being updated, you will see that happen as well ! thanks for reaching out to us.