Challenge - 5 Problems
ORM Mastery in Deno
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediateUnderstanding Prisma Client Initialization in Deno
Which code snippet correctly initializes Prisma Client in a Deno environment to connect to a PostgreSQL database?
Attempts:
2 left
💡 Hint
Remember to import PrismaClient from the correct package and instantiate it with 'new'.
✗ Incorrect
Prisma Client must be imported from '@prisma/client' and instantiated with the new keyword. Option D follows this pattern correctly.
❓ component_behavior
intermediateDrizzle ORM Query Behavior in Deno
Given the following Drizzle ORM query in Deno, what will be the output if the 'users' table has three entries with ids 1, 2, and 3?
Deno
const users = await db.select().from(usersTable).where(usersTable.id.gt(1)); console.log(users.length);
Attempts:
2 left
💡 Hint
The query filters users with id greater than 1.
✗ Incorrect
The query selects users where id is greater than 1, so users with ids 2 and 3 match, resulting in length 2.
📝 Syntax
advancedIdentifying Syntax Error in Prisma Schema
Which Prisma schema snippet contains a syntax error that will prevent generating the client?
Attempts:
2 left
💡 Hint
Check the attribute syntax for uniqueness.
✗ Incorrect
In Prisma schema, attributes like uniqueness must be prefixed with '@'. Option A misses '@' before 'unique', causing a syntax error.
🔧 Debug
advancedDebugging Drizzle ORM Insert Failure
Why does the following Drizzle ORM insert code fail to add a new user in Deno?
Deno
await db.insert(usersTable).values({ id: 1, name: 'Alice' });
Attempts:
2 left
💡 Hint
Consider how auto-increment fields are handled in inserts.
✗ Incorrect
If the 'id' column is auto-incremented, manually providing it can cause conflicts or errors. The insert should omit 'id' to let the database assign it.
❓ state_output
expertPrisma Client Query Result Shape in Deno
What is the shape of the result returned by this Prisma Client query in Deno if the 'posts' table has two posts with titles 'Hello' and 'World'?
Deno
const posts = await prisma.posts.findMany({ select: { title: true } });
console.log(posts);Attempts:
2 left
💡 Hint
The select option returns objects with only the selected fields.
✗ Incorrect
The findMany with select returns an array of objects containing only the selected fields. So each object has a 'title' property.
