Hello,
I am running Couchbase Server version 4.5.0-2601 Community Edition.
I have two buckets, ‘users’ and ‘items’, the latter having a field ‘user_id’ which is pointing to users.id.
If I run the query
select count(*) from users u where meta(u).id = '123456'
I get the desired result
[
{
"$1": 1
}
]
and if I run the query
select count(*) from items i where i.user_id='123456'
I get the desired result
[
{
"$1": 7
}
]
So, there are 7 items for that particular user. Therefore, if I run this query
select u.* from users u where exists (select user_id from items use keys meta(u).id)
I expect to get at least one result from the users table, the one for the user with documentId = 123456. Instead, I get 0 results:
{
"results": [],
"metrics": {
"elapsedTime": "1m51.332833098s",
"executionTime": "1m51.332770429s",
"resultCount": 0,
"resultSize": 0
}
}
What am I doing wrong?