In my couchbase bucket,some of the document contains “http://” urls are there .
I need a query to replace “http://” to “https://” Example: sample document,
{
name:“test”,
thumbUrl:“http://abc.com/test.png”
}
I want to replace above document content like,
{
name:“test”,
thumbUrl:“https://abc.com/test.png”
}
For updating single field this solution will work, but in my case I don’t know where url(http://) will come(might be from multiple properties).
I need to do a query for entire document.It should search “http://” and replace it with “https://”
If you want replace any where in the field you can use REPLACE(thumbUrl, “http:”,“https:”).
You will not be able to replace using N1QL without knowing the field name any where in the document.
If you want to know the document that has “http:” you can use following query, get the document using SDK’s and replace and update it back.
SELECT META(d).id
FROM default As d
WHERE ANY v WITHIN d SATISFIES CONTAINS(v,"http:") END;
could you please use replace in a full command (from beginning to end)? am having trouble implementing it. could you use replace on more than one field at a time?