ansaA
Convex Community4y ago
4 replies
ansa

Schemas vs Schemaless

So I have a conceptual question about convex! I was doing the counter/messages tutorial and adding the code for the messages portion seems to break the counter portion (I haven't updated App.tsx yet, only listMessage and sendMessage)
convex/incrementCounter.ts:4:37 - error TS2345: Argument of type '"counter_table"' is not assignable to parameter of type '"messages"'.
4   const counterDoc = await db.query("counter_table").first();
                                      ~~~~~~~~~~~~~~~
convex/incrementCounter.ts:6:21 - error TS2345: Argument of type '"counter_table"' is not assignable to parameter of type '"messages"'.
6     await db.insert("counter_table", {
                      ~~~~~~~~~~~~~~~
convex/incrementCounter.ts:12:16 - error TS2339: Property 'counter' does not exist on type '{ _id: GenericId<"messages">; _creationTime: number; author: string; body: string; }'.

12     counterDoc.counter += increment;

is it possible to leave both of these parts intact, or can you only interact with one db table at a time?
Was this page helpful?