Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

600
Vistas
NestJS/typeORM Vanilla - Cannot query across many-to-many for property

I'm using NestJS in the vanillaJS way (because I can't write typescript) and I have a many-to-many relation from user to bubble.

I want to write a updateUser-Route in which I also want to be able to update the bubble-affiliation.

But when I do so like this: user.controller.js:

  @Patch(':id')
  @Bind(Param('id'), Body())
  async updateUser(id, body) {
    if (Object.keys(body).length !== 0) {
      return await this.userService.updateUser(id, body);
    }
    throw new BadRequestException('Missing Body');
  }

user.service.js:

  async updateUser(id, user) {
    return await this.userRepository.update(id, user);
  }

I get this error: Cannot query across many-to-many for property bubble

This is my user.entity.js:

var EntitySchema = require('typeorm').EntitySchema;
var User = require('./user.model').User;
var Bubble = require('../bubble/bubble.model').Bubble;

module.exports = new EntitySchema({
  name: 'User',
  target: User,
  columns: {
    id: {
      primary: true,
      type: 'int',
    },
    handle: {
      type: 'varchar',
    },
    lastCheck: {
      type: 'datetime',
      default: () => 'NOW()',
    },
    rating: {
      type: 'int',
    },
  },
  relations: {
    bubble: {
      type: 'many-to-many',
      target: 'Bubble',
      joinTable: true,
      cascade: true,
    },
  },
});

in postman I try to call it like this:

{
    "rating": 10,
    "bubble": [{
        "id": "1234"
    }]
}

if I leave bubble out it works and rating gets updated. with bubble I get the error described above

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda