Reputation: 2599
I want to change "UpdatedFromIP" to "IP" in N1QL using update query ??
I want to do it for all json. where _type="log"
{
"UpdatedFromIP": "1.0.0.166",
"_type": "log",
"updatedBy": 529
}
Upvotes: 1
Views: 725
Reputation: 566
It sounds like you want to change the field name, which you can do with a combination of a SET clause (to add the new field name) and an UNSET clause (to remove the old field name) in the UPDATE statement. If your bucket were named 'default', the following query should work:
update default set IP = UpdatedFromIP unset UpdatedFromIP
where _type = "log" and UpdatedFromIP is not missing;
Upvotes: 3