All Questions
153
questions
0
votes
0
answers
91
views
Nest js, TypeOrm Connection close issue
I'm using NestJs, and Typeorm (MySQL driver). From time to time I get the 'Connection lost: The server closed the connection.' error.
The server that I'm using closes the connection after 10-15 ...
0
votes
0
answers
14
views
Typeorm Sub query is not working for getMany() [duplicate]
const queryBuilder = this.candidateRepository
.createQueryBuilder('candidate')
.innerJoinAndSelect('candidate.role_user', 'roleUser')
.leftJoinAndSelect('candidate.candidate_status', '...
0
votes
1
answer
38
views
Unable to setup One to One relationship in NestJs using TypeORM and mysql
In my nest application I have two tables Users and Profession I want to create OneToOne relationship between these two tables.
Below code demonstrates how I am achieving it, but it's only saving data ...
0
votes
0
answers
55
views
EntityMetadataNotFoundError: No metadata for "User" was found
i have a nestjs project that i've published it with github actions and then i want to use the service of it in my other project for example (registerUser).
but i am getting this error:
...
0
votes
0
answers
31
views
Typeorm Optimize Query - Fetch Message Rooms with only the latest message
I have a MessageRoom Table that can contain many messages.
I want to fetch all rooms with only the latest message.
This is for a chat app.
const rooms = this.roomRepository
....
1
vote
1
answer
76
views
SQL syntax error when trying to create a new table using TypeORM
I'm doing the backend for a project using NodeJS. To manage the DB I'm using typeorm.
I've created several tables with no issues.
Now I'm trying to create a new table (or entity) that has a date ...
0
votes
0
answers
121
views
TypeORM save function seems to generate individual insert statements instead of one bulk insert SQL
I am using TypeORM as the ORM for my PlanetScale (MySQL) DB. I want to insert records in bulk. My code looks like this:
const batch = [{name: 'a'},{name: 'b'},{name: 'c'},{name: 'd'},{name: 'e'}];
// ...
0
votes
0
answers
178
views
Typeorm UpdateValuesMissingError: Cannot perform update query because update values are not defined. Call "qb.set(...)" method to specify updated
Typeorm UpdateValuesMissingError: Cannot perform update query because update values are not defined. Call "qb.set(...)" method to specify updated...
i got that error when I'm trying to ...
0
votes
1
answer
244
views
Unable to connect mysql database in NestJS with Typeorm - ERROR: this.mysql.createPool is not a function
Currently, I'm starting to learn about the Nestjs and perform some crud operation but before start, I'm stuck in a database connection issue.
Also, My scenario is different compared to a normal ...
0
votes
0
answers
20
views
Is there a better way to implement a LIKE condition with multiple values using TypeORM?
For example, I want to query user, and the conditions:
1. age > 20
2. country = "japan" OR country = "singapore"
3. name LIKE '%alex%' OR name LIKE '%jone%'
And my where object:...
0
votes
0
answers
39
views
Unit testing endpoints which use MySQL and TypeORM
I´m unit testing my node.js backend application for the first time, so I have an issue with the endpoints that use entities from TypeORM. The testing libraries I´m using are jest, supertest, @...
0
votes
0
answers
48
views
QueryFailedError: Incorrect table definition; there can be only one auto column and it must be defined as a key
I am trying to create a manyToMany relationship between User table and Broker table and want to add some additional properties to it.
My idea is to add some additional properties into UserBroker ...
0
votes
0
answers
85
views
MySQL query with typeorm
I'm new to mysql and trying to make my problem solved. Have tried and now, let me ask you.
I am using typeorm, mysql and express.
Business logic is:
There will be cars with licenseNo and driver phone ...
0
votes
1
answer
37
views
TypeORM entitiy cascade option
I have two entities Order and Address and they have @ManyToMany relationship .
Address entity :
@ManyToMany(() => Order, (order) => order.address, { cascade: true })
@JoinTable()
order: Order;
...
0
votes
0
answers
56
views
Why doesn't TypeORM skip() and take() function work?
The Delivery table has got more than 4 million rows. I used MySQL database.
async adminDeliveriesViewCount (data) {
try {
const batchSize = 10;
let batchIndex = 0, totalDeliveries = 0;
while(...