Skip to content
Discussion options

You must be logged in to vote

Update

Since v1.0, Data no longer provides an object modeling syntax. Instead, it relies on a Standard Schema that you provide, using any Standard Schema-compliant libraries out there. For example, here's how you would describe your original factory using Zod:

const users = new Collection({
  schema: z.object({
    things: z.array(z.string()),
    // Use `z.record()` in Zod to describe an object
    // with dynamic keys.
    stuff: z.record(
      z.string(),
      z.object({
        foo: z.string(),
      }),
    ),
  }),
})

Data will respect this schema whenever you create/update/query properties.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@mauriceoc
Comment options

@mauriceoc
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by kettanaito
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants