Bulk inserts can be performed according to the documentation here:
import {getConnection} from "typeorm";
await getConnection()
.createQueryBuilder()
.insert()
.into(User)
.values([
{ firstName: "Timber", lastName: "Saw" },
{ firstName: "Phantom", lastName: "Lancer" }
])
.execute();
This is the most efficient way in terms of performance to insert rows into your database. You can also perform bulk insertions this way.
I'm not sure about the duplicate issue you are facing.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…