Typeorm trying to update non-existing entity

So I’m trying to run this code:

const entities = await this.repository.createQueryBuilder(User)
      .leftJoinAndSelect(`User.photos`, 'photos') // One-to-many
      .leftJoinAndSelect('photos.status', 'photoStatus') // One-to-one
      .where('photoStatus.status = :status', { status: PhotoEnum.READY_TO_SEND })
      .getMany();

And then performing some operations to update status inside PhotoStatus entity for every user. Assume that I have updated status to new one and then I’m running this code:

    const userEntities = aggregates.map(aggregate => aggregate.userEntity);
    if (tr) {
      await tr.save(userEntities);
      return;
    }
    await this.repository.save(userEntities)

In my database I have one user with two photos and only first photo has status inside and another one doesn’t have. When I’m logging userEntities, I see one entity with one photo attached. But when I’m running save for these entities batch, I’m encountering that typeorm also trying to update another photo, that don’t have status. It cause a lot of problems and the thing is that I cannot filter out this “invinsible” photo in my aggregate. What can be the solution here? I don’t want to filter them after query

I wrote this part-time solution, but I want to get all required users with photos from query.

const trueEntity = userEntities.filter((e) => {
      const entity = e.photos.find((t) =>
        t.photoStatus?.status === PhotoEnum.READY_TO_SEND);
      if (entity) {
        return e;
      }
    });