Hi there,
I was wondering if it’s possible to pass an array of objects as a parameter and have a query run while looping over each element?
Here’s a made up example of what I’m looking for:
User bucket
userA: { email: userA@userA.com, displayName: Rusty }
userB: { email: userB@userB.com, displayName: Shackleford }
Cars bucket
car1: { ownerId: userA, colour: green }
car2: { ownerId: userB, colour: blue }
car3: { ownerId: userA, colour: black }
I have an array. Each element in the array is a pair consisting of a user id and car id. What I want do to is perform a query that will return the user.displayName and colour of the corresponding car that they own. So if the array is:
[ { userA, car3 }, {userB, car2} ]
I want to return:
[ { displayName: Rusty, colour: black }, { displayName: Shackleford, colour: blue } ]
Right now I split up the array and send a separate query for each element. Is there way I can pass the whole array in a N1QL query and have it loop over each element before returning all of the results?
Thanks so much for all the help you guys provide to the community!!