Update tag value

I want to update the LOCATION tag from the value “DB-08” to “Main DB” for all entries. I am using the following command:
from(bucket: “power”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “summary”)
|> filter(fn: (r) => r[“IP”] == “192.168.9.108”)
|> filter(fn: (r) => r[“LOCATION”] == “DB-08”)
|> map(fn: (r) => ({r with LOCATION: if r.LOCATION == “DB-08” then “Main DB” else r.LOCATION}))
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> to(bucket: “power”)

I am unable to overwrite the existing data in the same bucket, but if I change the bucket, I can create new data.

Hello @Tachapong_Phantarak,
There ins’t a way to update a tag.
The best you could do is to rewrite it as you’re doing and then delete the data with the old tag.