Hello all,
I am new to Couchbase and learning N1QL. UPDATE and INSERT individually works okay. but when I try the MERGE INTO statement (Lookup merge with updates and inserts) , it performs update when matched on Key but does not perform insert when not matched.
This is the query I am using:
MERGE INTO travel-sample
t
USING [
{“Age”:“3”, “Name”: “Sophia”}
] source
ON KEY “15”
WHEN MATCHED THEN
UPDATE SET t.Age = source.Age
WHEN NOT MATCHED THEN
INSERT ({ “Name”: source.Name, “Age”: source.Age});
Please let me know where I might be going wrong.
Thanks.