I’m trying to switch to N1QL for joins and wonder if it possible to join by key and at the same time return join result by condition on key.
I have 2 kind of documents in the same bucket.
user, with keys like “user:123” (key includes userId)
device, with keys like “device:123:8888” (key includes userId and deviceId)
Total bucket size: 100 mln users, 200 mln devices
I want to:
- get user and list of user devices filtered by userId (and keys can be built from that inside N1QL for joins)
- get user and device filtered by userId+deviceId (user/device keys again built inside N1QL for joins)
Is it possible via N1QL at all? Could you please suggest some query?
Is it possible to do without any indices, using only keys? If its possible with indices only, I’d be grateful if you suggest some query too however indices is something I’d like to avoid, at the very least, index on device.userId can be added
Thanks in advance.