I want to get data from another bucket using the ID inside a document
The query I’m trying to execute:
SELECT meta().id,`docId`,`createdAt`,`updatedAt`,`data` FROM sales AS ccc
LET contact = (SELECT meta().id,`docId`,`createdAt`,`updatedAt`,`data` FROM contacts AS bbb USE KEYS [ccc.contactId])
WHERE status = 'active' LIMIT 10 OFFSET 0
Source doc:
{
"status": "active",
"data": {
"billingAddress": null,
"contactId": "1b529239ea294da687559e1464a8c5a8",
"count": 1,
"currency": "USD"
}
}
The doc I want to get "1b529239ea294da687559e1464a8c5a8",
{
"id" : "1b529239ea294da687559e1464a8c5a8"
"status": "active",
"data" : {
"name": "SpaceX", "location": {}
}
}
The query response I’m trying to get:
{
"status": "active",
"data": {
"billingAddress": null,
"contactId": "1b529239ea294da687559e1464a8c5a8",
"contact": { "data": { "name": "SpaceX"} }, // *trying to the contact in a contact var by selecting the name*
"count": 1,
"currency": "USD"
}
}