LessThan and other operators doesn't work
See original GitHub issueIssue type:
[ ] question [x] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[x] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[x] latest
[ ] @next
[ ] 0.x.x
(or put your version here)
Steps to reproduce or a small repository showing the problem:
I’m using typeorm inside js and it seems like the query parsed incorrectly, here is my example:
const entities = await Entity.count({
where: {
name: 'entityName',
updatedAt: LessThan(new Date()),
},
});
And here is the sql output:
SELECT COUNT(DISTINCT("Entity"."id")) as "cnt" FROM "entities" "Entity" WHERE "Entity"."name" = $1 AND "Entity"."updatedAt" = $2 AND "Entity"."deletedAt" IS NULL -- PARAMETERS: ["entityName",{"_type":"lessThan","_value":"2019-04-08T12:11:05.602Z","_useParameter":true,"_multipleParameters":false}]
It’s working great within Nest.js framework but doesn’t work inside a pure node.js file.
Another thing to mention - Methods works just fine like: Entity.find() Entity.count() etc … So I don’t think it’s something with the db connection
Issue Analytics
- State:
- Created 4 years ago
- Reactions:11
- Comments:18 (4 by maintainers)
Top Results From Across the Web
OR and less than operators not working as intended C language
If either a or b is non-zero, then the expression is true. In C, equality and relational operators like == , !=
Read more >Less than (<) - JavaScript - MDN Web Docs
The less than ( < ) operator returns true if the left operand is less than the right operand, and false otherwise.
Read more >Logical operators in Excel: equal to, not equal to, greater than ...
The tutorial explains the basics of Excel logical operators such as equal to, not equal to, greater than or equal to, less than...
Read more >13 Functions and expressions - Stata
The relational operators are > (greater than), < (less than), >= (greater than or equal), <= (less than or equal), == (equal), and...
Read more >Comparison and Logical Operators - Codecademy
Comparison Operators · Less than ( < ) — returns true if the value on the left is less than the value on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am experiencing the same problem with postgres:
Produces an error:
@Kononnable I logged the SQL query and it seems that LessThan stays an object, for example:
Will be:
instead
It seems that it didn’t work as a local npm installed package but when I deployed it and installed the package from github, it worked.
I believe it is something about the shared typeorm package and the connection itself, but it did worked partly in the local way…