You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using an unidirectional ManyToMany Collection, calling the function loadCount() on that Collection throws an error if the Collection is not initialized
Stack trace
Error: Trying to query by not existing property Class.undefined
at /..../node_modules/@mikro-orm/knex/query/CriteriaNode.js:21:27
at Array.forEach (<anonymous>)
at new CriteriaNode (/..../node_modules/@mikro-orm/knex/query/CriteriaNode.js:18:48)
at new ScalarCriteriaNode (/..../node_modules/@mikro-orm/knex/query/ScalarCriteriaNode.js:6:1)
at Function.createScalarNode (/..../node_modules/@mikro-orm/knex/query/CriteriaNodeFactory.js:22:22)
at Function.createNode (/..../node_modules/@mikro-orm/knex/query/CriteriaNodeFactory.js:19:21)
at Function.createObjectItemNode (/..../node_modules/@mikro-orm/knex/query/CriteriaNodeFactory.js:47:25)
at /..../node_modules/@mikro-orm/knex/query/CriteriaNodeFactory.js:38:28
at Array.reduce (<anonymous>)
at Function.createObjectNode (/..../node_modules/@mikro-orm/knex/query/CriteriaNodeFactory.js:37:45)
at Function.createNode (/..../node_modules/@mikro-orm/knex/query/CriteriaNodeFactory.js:17:25)
at QueryBuilder.where (/..../node_modules/@mikro-orm/knex/query/QueryBuilder.js:116:72)
at PostgreSqlDriver.count (/..../node_modules/@mikro-orm/knex/AbstractSqlDriver.js:139:14)
at SqlEntityManager.count (/..../node_modules/@mikro-orm/core/EntityManager.js:409:41)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at Collection.loadCount (/..../node_modules/@mikro-orm/core/entity/Collection.js:67:31)
To Reproduce
Steps to reproduce the behavior:
Create an unidirectional ManyToMany Collection
call the loadCount() function on the Collection (collection must not be initialized)
Expected behavior
The number of items should be returned
Describe the bug
When using an unidirectional ManyToMany Collection, calling the function loadCount() on that Collection throws an error if the Collection is not initialized
Stack trace
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The number of items should be returned
Additional context
When the Collection is initialized it works fine
When using a bidirectional ManyToMany Collection it works fine
Versions
| Dependency | Version |
| node | 14.15.4 |
| typescript | 4.0.5 |
| mikro-orm/core | 4.5.0 |
| mikro-orm/migrations | 4.5.0 |
| mikro-orm/nestjs | 4.2.0 |
| mikro-orm/postgresql | 4.5.0 |
The text was updated successfully, but these errors were encountered: