Bird
0
0

Identify the error in this NestJS Prisma update call:

medium📝 Debug Q6 of 15
NestJS - Database with Prisma
Identify the error in this NestJS Prisma update call:
await this.prisma.user.update({ data: { name: 'Alice' } });
AData object should be outside the update call
BIncorrect method name; should be updateOne
CMissing where clause to specify which record to update
DName field cannot be updated
Step-by-Step Solution
Solution:
  1. Step 1: Check required parameters for update()

    update() requires a where clause to identify the record.
  2. Step 2: Confirm missing where clause

    The code lacks where, so Prisma cannot know which user to update.
  3. Final Answer:

    Missing where clause to specify which record to update -> Option C
  4. Quick Check:

    update() needs where clause [OK]
Quick Trick: Always include where clause in update() calls [OK]
Common Mistakes:
  • Omitting where clause
  • Using wrong method name like updateOne
  • Placing data outside update()

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NestJS Quizzes