#Advice on my schema size, nesting.

3 messages · Page 1 of 1 (latest)

rare dust
#

Hello,

In terms of the limits stated in the docs - i would love to ask if there are any "danger signs" with this schemas size and its nesting?

Thanks a lot in advance!

export const videoSchema = {
  userId: v.id('users'),
  snippet: v.optional(
    v.object({
      title: v.optional(v.string()),
      description: v.optional(v.string()),
      thumbnails: v.optional(
        v.array(
          v.object({
            id: v.string(),
            url: v.string(),
            width: v.number(),
            height: v.number(),
          })
        )
      ),
    })
  ),
  tags: v.optional(v.string()),
  category: v.optional(v.string()),
  status: v.object({
    uploadStatus: v.union(
      v.literal('uploading'),
      v.literal('processing'),
      v.literal('ready')
    ),
    privacyStatus: v.union(
      v.literal('public'),
      v.literal('private'),
      v.literal('unlisted')
    ),
    publishAt: v.optional(v.number()),
  }),
  statistics: v.optional(
    v.object({
      likeCount: v.optional(v.number()),
      favoriteCount: v.optional(v.number()),
      commentCount: v.optional(v.number()),
      views: v.optional(v.number()),
    })
  ),
  funfact: v.optional(
    v.object({
      thumbnailId: v.id('_storage'),
      description: v.optional(v.string()),
    })
  ),
  suggestions: v.optional(v.array(v.string())),
  activity: v.optional(
    v.object({
      type: v.union(
        v.literal('quiz'),
        v.literal('challenge'),
        v.literal('tutorial')
      ),
      id: v.string(),
    })
  ),
  muxUploadId: v.optional(v.string()),
  metaData: v.optional(
    v.object({
      playbackId: v.optional(v.string()),
      aspectRatio: v.optional(v.string()),
      maxWidth: v.optional(v.number()),
      maxHeight: v.optional(v.number()),
      maxFrameRate: v.optional(v.number()),
      duration: v.optional(v.number()),
    })
  ),
}
quick pelican
#

@rare dust all looks reasonable to me. probably the biggest consideration is any arrays, you want to feel like you're going to consistently have "a handful" of values in them. 5, 10, maybe even 20 or whatever

#

by the time those arrays might grow out to hundreds or thousands of items, you probably should have another table and a reference (many to 1 etc)