Hi,
I’m trying to create a n1ql insert stament using the values from json as part of the key. For example, if I have this json {“id”:1, “name1”.“value1”} I need to create a insert stament like this:
INSERT INTO Bucket
(KEY , VALUE ) VALUES (id, {“id”:1, “name1”.“value1”}) where id in key part is the id value of the JSON. I saw that cbimport have a notation for key generator in order to do this. You can use %Id% and cbimport take the value of the Id from the json. So, How can I do the same than cbimport done using only n1ql?
Thanks a lot and regards.
INSERT INTO `Bucket` (KEY , VALUE ) VALUES ("1", {“id”:1, “name1”:“value1”});
INSERT INTO `Bucket` (KEY doc.id, VALUE doc ) SELECT {“id”:"1", “name1”:“value1”} AS doc;
Thanks a lot. It works like a charm.