When inserting an array with TypeORM, the order of id that comes out as result?

Viewed 378

TypeORM is working on inserting arrays using INSERT.
I'm going to do another task using the IDs that came out as a result of insert.
At this time, the IDs that come out as a result of insert come out in the order of array when insert?

// customRepository.ts
insertArr(nameArr : {name : string}[]){
    reuturn this.createQueryBuilder()
    .insert()
    .into(customTable)
    .values(nameArr)
    .execute()
}

// service.ts

        const connection = getConnection();
        const repository = connection.getCustomRepository('customRepository')
        const arr = [{name : 'first'},{name : 'second'}]


        const result =
          await repository.insertArr(
            arr
          );

        console.log('result : ', result);
        //Does this result come out in the order of insert?

Thank you!!!

0 Answers
Related