We have an old version of Order document in our couchbase(in millions) which we need to update with customer id from a Customer document. We came up with the following query to do so :
MERGE INTO `order_bck` orderdoc USING (SELECT customer.customerInformation.uuid AS uid, customer.customerInformation.customerId as customerId FROM `order_bck` AS custInfo WHERE META(custInfo).id LIKE ':custInfo:%') AS source ON orderdoc.uid = source.uid WHEN MATCHED THEN UPDATE SET orderdoc.customerId = source.customerId WHERE META(orderdoc).id LIKE ':orderdoc:bck:%;
The Customer document and the Order doc have a matching UID. So the query basically updates the customer Id into the Order document which it gets from the customer document which has a matching UID with an Order document.
Couchbase version : 6.6.1
Problem: This query doesn’t update all the Order documents consistently. Sometimes it does other times some random number of Order documents get updated. However, every time we get a success message in the response. We are updating using the
cbq utility of Couchbase. I also set an infinite timeout i.e. 0 however observed the same behavior.
- Is there a problem with the query? I don’t think so as it does update all the required documents sometimes. Also its not a live system so the number of documents is static.
- Which Couchbase logs should I check to debug and figure out other kinds of issues like memory or network etc.or any other potential issue?