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
PanacheMongoRepository does not deal well with instants #6566
Comments
@loicmathieu could you have a look? |
@TheVidAllMayThe Can you try with
You can active query logging to check that the correct query is created by MongoDB with Panache via
Please activate it and give us the query to help diagnose the issue. |
That was my bad, I really wanted the behavior to be of "<", not "<=". @loicmathieu when trying as you suggested I get this:
I'm guessing it should be translated to |
OK, so the issue is that As a workaround you may be able to do (not tested)
Anyway, I'll work for a fix. |
@loicmathieu Uunfortunately this does not work, as it results in: The only way I've got it to work was by writing the query manually: |
@loicmathieu I don't think this was properly fixed. In version 1.2.0.Final, when I do
And same with The problem seems to be on the missing Z at the end: I find it odd that the Z disappears now since it shows if you call the toString() method in any Instant. So to get it working now I need to change the workaround to |
@TheVidAllMayThe I reopen the issue, will have a look next week |
@TheVidAllMayThe I works on this now and the date format is not OK for both See this generated query with all the supported formats
I will fix this issue but it raises the question of adding Z at the end to express the fact that it's UTC dates. In fact it's true for Instant but not for LocalDateTime as they are local so expressed in the server current timezone. I can move them at UTC timezone to be consistent. |
When using the PanacheMongoRepository to query the database using Instants the Inventory does not find any results unless the query is written in mongo syntax.
fun getByCreationInstantBefore(time: Instant) = list("endAt < ?1", time)
Should return the Commands present in the database with endAt < time but returns an empty list.
Steps to reproduce the behavior:
fun getByCreationInstantBefore(time: Instant) = list("{endAt : { \$lte : ISODate(?1) }}", time)
works wellThe text was updated successfully, but these errors were encountered: