我有这个查询:
select otherDocKey from bucket use keys '1234'
update bucket use keys 'hear I need the result of the first query' set ...
我想做这样的事情:
update bucket use keys (select otherDocKey from bucket use keys '1234') set kuku = 3
但我得到的答复是:
[ { "code": 5030, "msg": "Missing or invalid primary key map[otherDocKey:\"56443\"] of type map[string]interface {}." } ]
有没有一种方法可以在一个查询中做到这一点?
我正在使用Couchbase 4.5版
您的查询的问题是嵌套的子查询返回json结果。即,查询:
select otherDocKey from bucket use keys '1234'
将返回如下结果:
{"otherDocKey":"This_is_the_key_for_the_other_doc"}
但是您不想要json,而只想要json中的值。为此,您需要使用“选择原始”。例如,
select raw otherDocKey from bucket use keys '1234'
那应该给你看起来像这样的结果:
["This_is_the_key_for_the_other_doc"]
当子查询返回这种结果时,“使用键”应该可以正常工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句