Open Ademboussetha opened 1 year ago
Hi @Ademboussetha, thank you for reporting this issue you have encountered. Unfortunately, I have not been able to reproduce it.
I created 26 entries (default response length is 25 entries) and performed a request with a perimeter of 5000. See screenshot.
Everything worked as expected with no error. Could you please provide more info how I could reproduce the behaviour you are enctoutering?
Thank You :)
Hello @omikulcik,
I appreciate your prompt response.
To replicate the error effectively, it might be beneficial to populate your collections with a larger number of elements. In my particular scenario, specifying a range of "450" for instance, results in a total of 500 rows of data being returned. However, it appears that in your case, only 26 rows are being returned.
Hence, I recommend augmenting the entries within your collection to accurately reproduce the issue.
Thank you for your attention to this matter. Please let me know if you need any more information.
I was successful replicating the bug. However, I do not know how to fix it. It seems that even if I change the scructure back to array it transforms back to object somehow. Will get back to it later.
@Ademboussetha Just FYI I have discussed this with our senior Strapi developer and even he was not able to solve it so we will contact someone from Strapi.
@omikulcik I've come up with a solution, but it's more of a workaround that involves processing the array in chunks of 100 at a time.
@Ademboussetha You can submit a PR with the solution if you want. We have discussed this with Strapi and the are unsure why this might be happening. They think it might be a bug in Koa which is a dependency of Strapi.
Issue Description
When making a request to the Strapi plugin with the
$location[coords]
parameter, I've observed an issue where if I set the radius to a value greater than 406, it results in an error:Error: Undefined attribute level operator 0
. Upon further investigation, it seems that this error is related to a change in the data type of the variable when the array of IDs contains a large number of elements.Steps to Reproduce
?$location[coords]=40.848557,14.255131,406
.Error: Undefined attribute level operator 0
.Expected Behavior
The plugin should handle requests with a radius greater than 406 without producing an error.
Additional Information
I noticed that when the array of IDs becomes large, the data type of the variable appears to change from an array of numbers to an array of objects. This transition in data types may be the root cause of the issue.
Environment
Please let me know if you need any more information or if there are specific steps to reproduce the issue.
Screenshots