RayyR
Convex Community2y ago
2 replies
Rayy

How can I define dynamic keys for nested objects in schema?

  v.object({
    question: v.string(),
    answer: v.string(),
    yourAnswer: v.optional(v.object({property: v.string()})),
    options: v.optional(v.array(v.string())),
  })


This is my object, I want the property key to be dynamic of type string, how can I achieve the same in Convex?

The yourAnswer object will have this value

{
  1: "abc",
  2: "def",
...  
}
Was this page helpful?