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
// before call create()
[
{
"name": "name 1"
},
{
"name": "name 2"
}
{
"name": "name 3"
}
{
"name": "name 4"
}
]
// after call create()
[
{
"id": 1,
"name": "name 1"
},
{
"id": 1, // should be 2
"name": "name 2"
}
{
"id": 1, // should be 3
"name": "name 3"
}
{
"id": 1, // should be 4
"name": "name 4"
}
]
It seems the only problem with bulk insertion. When I try to insert one record per query, I got the ID as I expected. But inserting one record per query is a really bad way if you want to insert many records.
Any advice is welcome!
The text was updated successfully, but these errors were encountered:
Well, close enough to fixed. We can't actually get the values back again during this operation. ): So we guess at what they should be. It's a temporary fix until something more exact is available.
Issue type:
[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ]
cordova
[ ]
mongodb
[ ]
mssql
[x]
mysql
/mariadb
[ ]
oracle
[ ]
postgres
[ ]
cockroachdb
[ ]
sqlite
[ ]
sqljs
[ ]
react-native
[ ]
expo
TypeORM version:
[x]
latest
[ ]
@next
[ ]
0.x.xx
(or put your version here)Steps to reproduce or a small repository showing the problem:
I'm using bulk insertion to insert many records to DB as its the most efficient way in terms of performance.
https://github.com/typeorm/typeorm/blob/master/docs/insert-query-builder.md#insert-using-query-builder
But the auto-incrementing column doesn't work as I expected
Here is my code
Migration
My Model
Query function
when I inserted 4 pages to the database, the result looks like this
It seems the only problem with bulk insertion. When I try to insert one record per query, I got the ID as I expected. But inserting one record per query is a really bad way if you want to insert many records.
Any advice is welcome!
The text was updated successfully, but these errors were encountered: