Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

506
Visualizações
Why does find method return empty array in typeorm
  async create(
gPriceChangeDto: GPriceChangeDto,
gainerEntity: GainerEntity,
): Promise<GPriceChangeEntity> {
const findGPriceChange = await this.gPriceChangeRepository.find();
const priceChange = await this.gPriceChangeRepository.create(
  gPriceChangeDto,
);
console.log(findGPriceChange); // []
priceChange.gainer = gainerEntity;
await this.gPriceChangeRepository.save(priceChange);
await this.gPriceChangeRepository.delete(
  findGPriceChange?.map((item) => {
    return item.id;
  }),
);
return priceChange;
}

I have a problem that when I call the find method, it returns an empty array to me. I have a "OneToOne" relation in a file. And in the console I get this error.

[Nest] 8687  - 03/11/2022, 9:47:30 PM   ERROR [Scheduler] TypeORMError: Empty 
criteria(s) are not allowed for the delete method.
[Nest] 8687  - 03/11/2022, 9:47:30 PM   ERROR [Scheduler] TypeORMError: Empty 
criteria(s) are not allowed for the delete method. I am using nestjs.
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda