Skip to content
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

Can't query by RealmInstant #1657

Closed
michaellinder1995 opened this issue Feb 12, 2024 · 2 comments
Closed

Can't query by RealmInstant #1657

michaellinder1995 opened this issue Feb 12, 2024 · 2 comments

Comments

@michaellinder1995
Copy link

michaellinder1995 commented Feb 12, 2024

How frequently does the bug occur?

Always

Description

Example class in kotlin sdk:

class Workout : RealmObject { /** PROPERTIES */ @PrimaryKey var id: RealmUUID = RealmUUID.random() var created: RealmInstant? = RealmInstant.now() }

Example call (empty result):

val workouts = realm.query(Workout::class, query = “date < $0”, RealmInstant.now()).find()

Sadly i always get an empty result. No matter which direction of the comparison operator I'm using.
I did’nt find anything in the documentation how to query Realminstant:
https://www.mongodb.com/docs/realm/realm-query-language/ 1

Anyone knows how to create the query or what datatype i should use instead? Currently my workaround would be to query all and then do the filtering with standard Kotlin function. But performance sucks.

Hope anyone can help.

Version

1.12.0

@kneth
Copy link
Contributor

kneth commented Feb 13, 2024

In the class, the field is called created while you use date in the query. Is that a typing mistake?

@michaellinder1995
Copy link
Author

Oh shit :D

I had a second var
var date: RealmInstant? = null

That wasn't set. Thanks so much!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants