0

例如,我有两个文件:

{
  communication: "some data 1"
  users: [
    {
      name: 'Peter',
      role: 'admin'
      gender: 'male'
    },
    {
      name: 'John',
      role: 'guest'
      gender: 'male'
    }
  ]
}


{
  communication: "some data 2"
  users: [
    {
      name: 'Kollins',
      role: 'admin'
      gender: 'male'
    },
    {
      name: 'Steve',
      role: 'moderator'
      gender: 'male'
    }
  ]
}

最后,我必须获取users数组中没有userwith的文档role: 'guest'。基于两个文档的示例,我必须获得第二个文档。伪代码如下: select * from bucket where users.role = 'guest' is missing

4

1 回答 1

1

您需要映射用户数组ARRAY并检查是否有用户NOT EXISTS

SELECT * FROM bucket WHERE NOT EXISTS ARRAY users FOR user IN users 
WHEN user.role='guest' END
于 2017-05-09T09:56:58.463 回答