Код

Код


async function main() {

 const limit = 10;

 const jsonFieldName = "firstName";

 const jsonFieldValue = "John";


 const result = await prisma.$queryRawUnsafe<Array<{ name: string }>>(

  `SELECT DISTINCT

    (name)

  FROM

    Account

  WHERE

    meta ->> "$.${jsonFieldName}" = ?

  LIMIT ?;

`,

  jsonFieldValue,

  limit

 );


 console.log(result);

}

Report Page