Hey!
I’m working on a project where products are saved to multiple lists.
The current implementation is as follows:
- A user can create a list (the list has an id)
- A user can add a product to a list
→ this is being done via a reference to the list database.
→ two DB tables. Lists and ProductListReference which is a product ID ref to Store/Products .
→ these are also member specific and don’t allow lists to bleed in from other users.
Right now I’m suffering with a bizarre error which there doesn’t appear to be much information on.
The error happens when I add more than about (8) items to the list. It works fine with about 1 - 5 items that I’ve tested, not sure what the cut off point is but not sure that matters.
The error is as follows:
Error: {
"message": "Too many children (10) for logical operator",
"details": {}
}
I have narrowed down the error to the following bit of code:
let query = wixData.query(DB_STORE_PRODUCTS).eq('_id', productList[0].productId);
for (let i = 1; i < productList.length; i++) { query = query.or(wixData.query(DB_STORE_PRODUCTS).eq('_id', productList[i].productId)); }
query.find().then(results => // <- THE ERROR HAPPENS SOMEWHERE IN HERE
{
console.log("This will not execute");
// code here
})
.catch(error => console.error);
It appears to be something wrong with the query.
Any help is greatly appreciated.
Kind regards,
Blake