Hello,
I am using Couchbase Server CE 4.1.
I have the following document:
conversation::1
{
"_id": "1",
"_type": "conversation",
"members": {
"user_account::1": {
"removed": false,
"joined_at": 1472741410
},
"user_account::2": {
"removed": false,
"joined_at": 1472741410
}
},
"started_at": 1472741410
}
Passing an array of [“user_account::1”,“user_account::2”], I want to get every conversation that exact matches the keys of the members subdocument in the doc.
No more, no less members. Exactly the same.
I have tried the following approach, as it would be something that “literally” made sense to me, but it didn’t work.
SELECT * FROM `messenger`
WHERE _type = "conversation" AND
EVERY ON KEYS account_id IN members SATISFIES account_id IN ["user_account::1", "user_account::2"] END
EDIT: After digging a bit, I’ve found out that the following does give me almost nearly results to what I want:
SELECT * FROM `messenger`
WHERE _type = "conversation" AND
OBJECT_NAMES(members) = ["user_account::1","user_account::3"]
However if I do change the order of the array being compared, it will not match. I have looked for an ARRAY_DIFF or ARRAY_INTERSECT, but it doesn’t look like N1QL does have that. Any ideas?
Any ideas on how could I get it working?
Thanks.