When running a query with a where filter with an AND that contains objects with more than one key, for example:
Model.find({
where: {
and: [
{ key1: 'value1' },
{
key2: 'value2',
key3: 'value3'
}
]
}
}
I receive the following error:
ArangoError: bind parameter 'param_3' was not declared in the query (while parsing)
For my case, this is happening when adding an additional criteria to a polymorphic relationship:
model.polymorphicRelationship({ where: { criteria: true } })
As loopback generates one set of criteria for the polymorphic constraints (discriminator and foreign key), and another for the criteria I am providing.
I believe that the code causing this issue is found here.
Specifically that only the first key of the object is being used as criteria, but all of bindVars are being passed (thus the mismatch between query params and bindVars).
if condValue and condValue.constructor.name is 'Object'
# condition operator is the only keys value, the new condition value is shifted one level deeper and can be a object with keys and values
options = condValue.options
condOp = Object.keys(condValue)[0]
condValue = condValue[condOp]
Thanks for the attention.
When running a query with a where filter with an AND that contains objects with more than one key, for example:
I receive the following error:
ArangoError: bind parameter 'param_3' was not declared in the query (while parsing)
For my case, this is happening when adding an additional criteria to a polymorphic relationship:
model.polymorphicRelationship({ where: { criteria: true } })As loopback generates one set of criteria for the polymorphic constraints (discriminator and foreign key), and another for the criteria I am providing.
I believe that the code causing this issue is found here.
Specifically that only the first key of the object is being used as criteria, but all of bindVars are being passed (thus the mismatch between query params and bindVars).
Thanks for the attention.