-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
DeleteResult / UpdateResult not implemented for all Drivers #2415
Comments
I'll fix that.
because it wasn't implemented. We already have this feature reported, but noone still took on its implementation. Please feel free, its an easy feature to implement. |
@pleerock Can you give a reference to an earlier report? I just tried, but was unable to find one. |
I could find only #1308 which is related, need to search deeper to find that one. But anyway, you don't need that issue if you want to implement it. You know what your goal, you can easily do that. But please be sure to implement it for all drivers if you are going to do it. That's easy feature to implement |
@pleerock Currently the behavior is different between Postgres and MySQL, for example. MySQL returns: Postgres returns: So in a sense it seems MySQL already has this feature implemented but not Postgres. |
I have the same problem with SQLite and 0.2.8 |
|
MongoDb does not return anything, neither raw nor affected regardless if the record is found/deleted or not. |
In case it helps anyone else in the future, for postgres I ended up just using await this.db.createQueryBuilder()
.delete()
.whereInIds(id)
.returning("id")
.execute(); It returns a DeleteResult like: |
Is this implemented? I'm facing this issue too with sqlite3 and |
this didn't work for me, it just returns an empty object. I use [email protected]. |
Has it been fixed? |
same issue for me. any solution.. |
Same issue. Deleting record in MongoDB results an empty DeleteResult object |
Trying to change from sequelize... and i hit this "bug", quite sad this issue is still open.. |
@AndreySavenkov Same here. I'm curious, how did you managed that then ? |
Is there any alternative solution for this?
|
sqlite |
+1 |
@imnotjames can you also add |
Same issue in mssql driver |
This should be fixed also for the "INSERT" where Postgres returns number of inserted rows. |
Not fixed to SQLite3?
|
Two years and same problem with Mongo: it always returns |
Why is this not a priority? |
So, am I correct: there is no way to check whether any rows have been affected by delete method for PostgreSQL, right? |
@Kolobamanacas this works as expected for postgres on
|
No one really looking in to UpdateResult or DeleteResult for mongodb, its been a while this thread is still open.. |
Still getting empty result using MongoDB driver. |
The logic for query results have been moved into the drivers via #7753 This means implementing it is up to the drivers. The MongoDB driver doesn't return lots of this because it's EXTREMELY janky. It was implemented to query by not really doing things like any other driver & hacks up the whole TypeORM library to make it barely work.. Might still be able to make it sort of work, though, if the underlying module supports it. Even then, though, it might not help much because it doesn't use the query builder and all that jazz. |
This should be implemented for every driver now except for MongoDB with #7753 - to be in the next release. |
Opened a PR to implement it for the mongo EntityManager because that seems to be where that logic lives.. |
And for the rest of the drivers? sqlite here, neither DeleteResult nor UpdateResult have the right info |
With the master branch? |
"typeorm": "^0.2.34", |
This code has not been released yet. We're aiming for a release this week. We'll also be aiming to do a "bleeding edge" set of releases. |
I'm still having this issue in SQLite3. Any news about it? |
Should be released at this point. If it's not working for your use case please open a new issue. |
it is not solved yet but you can do it by yourself
|
2024 now. |
As noted by @DanielYoung-Till this is still not resolved in 0.3.20. Code:
Expected:
Actual:
|
Issue type:
[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ]
cordova
[ ]
mongodb
[ ]
mssql
[ ]
mysql
/mariadb
[ ]
oracle
[x]
postgres
[ ]
sqlite
[ ]
sqljs
[ ]
react-native
TypeORM version:
[ ]
latest
[ ]
@next
[x]
0.2.7
(or put your version here)Steps to reproduce or a small repository showing the problem:
Repository.delete
DeleteResult
does not include any info at all. Expecting to include the number of affected rows.I'm having trouble with
Repository.delete
: the operation successfully removes the entity from the database, butDeleteResult
does not contain count of entities deleted, it's justDeleteResult { raw: [] }
. This occurs with v0.2.7.Also, there doesn't appear to be a tag for version 0.2.7 on GitHub though there's a release on npmjs. Why is that?
Why doesn't
DeleteResult
specify a property for the number of rows affected?The text was updated successfully, but these errors were encountered: