10.Select DISTINCT

可以使用DISTINCT关键字来消除重复文档的输出。

Query:

SELECT DISTINCT orderlines[0].productId
    FROM orders

结果

{
  "results": [
    {
      "productId": "coffee01"
    },
    {
      "productId": "tea111"
    }
  ]
}

对比查询

SELECT  orderlines[0].productId
    FROM orders

结果:

{
  "results": [
    {
      "productId": "coffee01"
    },
    {
      "productId": "coffee01"
    },
    {
      "productId": "tea111"
    },
    {
      "productId": "coffee01"
    }
  ]
}

Last updated

Was this helpful?