kstulgysK
Convex Communityโ€ข2y agoโ€ข
1 reply
kstulgys

Can I make table relation field optional? Example ๐Ÿ‘‡

  users: defineEnt({})
    .field("email", v.string(), { unique: true })
    .edges("apiKeys", { ref: true }),
    .edges("downloads", { ref: true })

  apiKeys: defineEnt({})
    .field("hashedApiKey", v.string(), { unique: true })
    .edges("downloads", { ref: true })
    .edge("user"),

  downloads: defineEnt({})
    .edge("user")
    .edge("apiKey"),



I want todo this and this is not working, convex complains:

  downloads: defineEnt({})
    .edge("user", { optional: true })
    .edge("apiKey", { optional: true }),
Was this page helpful?