Search code examples
node.jspostgresqlmikro-orm

Mikro Orm v6 .raw function doesnt exist in createQueryBuilder


I am having an issue with the upgrade to mikrOrm v6 and cannot find any documentation on what I can do to upgrade. I keep getting an error for qb.raw doesnt exist on createquerybuilder. Is there an alternative in v6? This was working fine in V4.

refrence Code

        const qb = em.createQueryBuilder(Category);

        return qb
          .update({ score: qb.raw("score + 1") })
          .where({
            category: p.category.id,
            user: v.from.id,
            userCat: { $ne: null },
          })
          .execute();

Solution

  • https://mikro-orm.io/docs/upgrading-v5-to-v6#raw-sql-fragments-now-require-raw-helper

    Not sure what docs you were reading…