// index.tsconst coursesList = await db .select({ title: courses.title, tags: tags.tag }) .from(courseTags) .leftJoin(courses, eq(courses.id, courseTags.courseId)) .leftJoin(tags, eq(courseTags.tagId, tags.id));
# actual outputcourses: [ { title: "Course 1", tags: "Tag 1" }, { title: "Course 2", tags: "Tag 2" }, { title: "Course 3", tags: "Tag 3" }, { title: "Course 1", tags: "tag 4" }, { title: "Course 1", tags: "tag 5" }]
# desired outputcourses: [ { title: "Course 1", tags: ["Tag 1", "tag 4", "tag 5"] }, { title: "Course 2", tags: ["Tag 2"] }, { title: "Course 3", tags: ["Tag 3"] }]
const courses = db.query.userCourses .findMany({ where: eq(placeholder("userId"), userCourses.userId), columns: {}, with: { courses: true }, }) .prepare("courses");
'placeholder' is deprecated. typescript (6385) [1, 14]The signature '(name: "userId"): Placeholder<"userId", any>' of 'placeholder' is deprecated. typescript (6387) [9, 15]