New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filters Doesn't Pass When There's Negative Numbers #13364
Comments
I think it's because you defined Lat and Long as a String in your schema. You need to use Float or Int for the filter to be able to work. GraphQL model
type Affiliate @model @searchable {
id: ID!
name: String!
lat: Float!
lng: Float!
}
|
Hey @ChristopherGabba lol you were right. I thought it was already a Float.
it's not returning any data. using eq with the name field (String) works tho. any idea on this one? |
Disclaimer, I'm some random struggling with DynamoDB as well. Without seeing your data, and knowing what's in there, the For example, lets say I just use a basic list query like you have used to find all people with the first name John. If I have 500 users registered, and I set my query limit to 100, it's going to read through the first 100 people in the database and completely ignore the next 400 unless I provide a nextToken. That's called a That being said, using your filter expressions like you did above is going to get the first say 100 affiliates in your database and then filter them by your data, because you are using the |
I'm going to close this issue as the original issue has been solved thanks to @ChristopherGabba, but I would recommend opening a new one regarding the issue of no data being returned to track it separately as a potential bug and with details for the team to reproduce |
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
GraphQL API
Amplify Version
v6
Amplify Categories
api
Backend
Amplify CLI
Environment information
Describe the bug
I'm trying to get all the records in my db filtering by lat and lng, I have a range for each field (lat, lng)
for lat it's all good because I don't have negative numbers. but for lng it's not passing.
In the following example you can see this is correct:
-172.9272442976304 <= -116.604305 && -116.604305 <= -60.28136570236959
. But for the amplify filters it's not correct.This is my query statement:
it does not return any data when it should. Also if the minLng is bigger than the second one I get this error:
for example: -90 and -120 triggers the error, but -120, and -90 doesn't. It's kinda like if the values are parsed to positive to make the comparison or something like that. Because -90 is bigger than -120.
So I'm just wondering if there's any solution for this, in order to filter using negative values as lat, lng.
Expected behavior
Filter the records in my db in order to get the nearest to the user.
Reproduction steps
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
Iphone 15 pro Simulator
Mobile Operating System
IOS 17.4
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: