Replies: 6 comments 3 replies
-
Mongo docs are not really relevant when you use the ORM methods. Provide some code, logs are not a reproduction. |
Beta Was this translation helpful? Give feedback.
-
Hi @B4nan Found out, how it works with the tests. I updated this discussion with a test. Hope it gives the necessary point of the Problem. Regards |
Beta Was this translation helpful? Give feedback.
-
@B4nan ` ` gives: I will provide tomorrow a test and a new conversation. Just in case you currently working on it. |
Beta Was this translation helpful? Give feedback.
-
OK, no problem. Did it with regexp: |
Beta Was this translation helpful? Give feedback.
-
@B4nan |
Beta Was this translation helpful? Give feedback.
-
Great. Thank you very much! Works perfectly! |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
Hello
With mongodb-driver the findByCursor function doesn't respect the mongodb-syntax in the where clause (from the orderBy) for Date-Attributes.
I'm not sure if my assertion is correct, as I can't estimate how accurately the log entries reflect the actual query. I tried to search with findByCursor and didn't get any hits. Then I found in the logs the expression and tried it with MongoDB Compass.
According to MongoDB Documentation its necessary to wrap a date-attribute with new Date()
the change should be like:
before:
{valuta: { '$lte': '2022-12-27T00:00:00.000Z' }}
after
{valuta: { $lte: new Date("2022-12-27T00:00:00.000Z") }}
BTW: The log-entrie is also writing:
'$or': [ [Object], [Object] ]
I think there is something missing...
Reproduction
Test-File:
orderByWithDate.test.txt
(rename it to orderByWithDate.test.ts)
What driver are you using?
@mikro-orm/mongodb
MikroORM version
6.2.1
Node.js version
v20.12.2
Operating system
Ubuntu 22.04.4 LTS
Validations
Beta Was this translation helpful? Give feedback.
All reactions