Skyblue (Matt)S
Convex Community12mo ago
46 replies
Skyblue (Matt)

Apply generated document id to a non-system field in schema

Hey all! I'm evaluating convex along with a few other services. The promises of convex are very exciting and what drew my attention to it. But I'm getting hung up on the inability to control document schema completely.

Here's what I'm trying to do:
tags: defineTable({
    id: v.id("tags"),
    title: v.string(),
    description: v.optional(v.string()),
    createdAt: v.number(),
    lastModifiedAt: v.number(),
  })


I know that using the v.id() is meant for storying references. But I was really hoping to use it to also generate the document id with a different name. I would prefer to not pass on the system fields to the client and use underscores. Planning to use zod to strip those out of responses.

Is there a way to apply the document id to a non-system field of my choosing?
Was this page helpful?