Deleted User
Deleted User
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
I used Entity Framework at old times 😄 its now looking like a magic to me
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
I should definitely say Convex is a game-changer in web industry, hope it becomes more common soon
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
Thanks for your all support and sorry for my inconvenience. I couldnt continue on my project cuz of this 😦
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
hmm this can solve my problem
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
But i dont know how to do each of those
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
I have two solutions: - having a category_name in tasks table - reaching category_name from tasks somehow and returning it back and use
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
error is expected but what is solution to get category_name from tasks in short
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
Property 'category_name' does not exist on type '{ _id: Id<"tasks">; _creationTime: number; name: string; category_id: Id<"task_categories">; desc: string; time: string; }'.
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
actually problem is this for now:
const tasks = await ctx.db.query("tasks").collect()
typeof tasks = {
_id: Id<"tasks">;
_creationTime: number;
name: string;
category_id: Id<"task_categories">;
desc: string;
time: string;
}[]
{tasks.map((item, idx) => {
<span>{item.category_name // but there is no}</span>
const tasks = await ctx.db.query("tasks").collect()
typeof tasks = {
_id: Id<"tasks">;
_creationTime: number;
name: string;
category_id: Id<"task_categories">;
desc: string;
time: string;
}[]
{tasks.map((item, idx) => {
<span>{item.category_name // but there is no}</span>
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
task_categories: defineTable({ name: v.string() }),
tasks: defineTable({
category_id: v.id("task_categories"),
desc: v.string(),
name: v.string(),
time: v.string(),
}),
task_categories: defineTable({ name: v.string() }),
tasks: defineTable({
category_id: v.id("task_categories"),
desc: v.string(),
name: v.string(),
time: v.string(),
}),
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
cuz as i said when i define relations at schema, its not allowing to write queries like that
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
what kind of schema should i define to achieve this queries
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
i want name from tasks table and category_name from categories table as base
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
get all posts with id, content with comments of authorId for ex
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
I am in search for this syntax:
const posts = await db.query.posts.findMany({
columns: {
id: true,
content: true,
},
with: {
comments: {
columns: {
authorId: false
}
}
}
});
const posts = await db.query.posts.findMany({
columns: {
id: true,
content: true,
},
with: {
comments: {
columns: {
authorId: false
}
}
}
});
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
tasks.category_id = categories.category_id
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
at traditional way there is a thing to do this, i am wondering if convex also have this
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
I checked that too and other Ents docs
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
const tasks = await ctx.db.query("tasks").collect()
typeof tasks = {
_id: Id<"tasks">;
_creationTime: number;
name: string;
category_id: Id<"task_categories">;
desc: string;
time: string;
}[]
{tasks.map((item, idx) => {
<span>{item.category_name // but there is no}</span>
const tasks = await ctx.db.query("tasks").collect()
typeof tasks = {
_id: Id<"tasks">;
_creationTime: number;
name: string;
category_id: Id<"task_categories">;
desc: string;
time: string;
}[]
{tasks.map((item, idx) => {
<span>{item.category_name // but there is no}</span>
49 replies
CCConvex Community
Created by Deleted User on 5/21/2024 in #support-community
About querying relational data and getting data from joined table fields
I mean i need to access a category name belong to a task
49 replies