从复杂文档返回数组
Returning array from complex documents
我正在尝试将 id 数组放入字符串数组而不是对象中。
以下查询有效:
SELECT * FROM c.id
Returns:
[
"92226d610a1047ecb207c98f845bde14",
"3936d9172f8c4bfd891a91457935f1ac",
"ab466a79f1b44fc99c0f2fcefbec0aa2",
"0d5254279e02430ba8f09afbbd6f2259",
"b768a932ac9042f096557eea3ad5bc4e",
"6917916a41724249a1ae85963f46d58d",
"593ff8f0ceab4b2c8279d77b270307e4"]
然而,当我添加一个 where 子句时它失败了:
SELECT * FROM c.id where c.vesselId="6c0f3e571b0f4e3bb96f82e6b08d8d36"
使用 where 子句获取数组的最佳方法是什么?
您可以使用 distinct value
子句将 id 派生为数组。
select distinct value c.id from c where c.vesselId ='6c0f3e571b0f4e3bb96f82e6b08d8d36'
我正在尝试将 id 数组放入字符串数组而不是对象中。
以下查询有效:
SELECT * FROM c.id
Returns:
[
"92226d610a1047ecb207c98f845bde14",
"3936d9172f8c4bfd891a91457935f1ac",
"ab466a79f1b44fc99c0f2fcefbec0aa2",
"0d5254279e02430ba8f09afbbd6f2259",
"b768a932ac9042f096557eea3ad5bc4e",
"6917916a41724249a1ae85963f46d58d",
"593ff8f0ceab4b2c8279d77b270307e4"]
然而,当我添加一个 where 子句时它失败了:
SELECT * FROM c.id where c.vesselId="6c0f3e571b0f4e3bb96f82e6b08d8d36"
使用 where 子句获取数组的最佳方法是什么?
您可以使用 distinct value
子句将 id 派生为数组。
select distinct value c.id from c where c.vesselId ='6c0f3e571b0f4e3bb96f82e6b08d8d36'