oscklm
oscklm16mo ago

Advice on my schema size, nesting.

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()),
})
),
}
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()),
})
),
}
2 Replies
jamwt
jamwt16mo ago
@oscklm 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)
oscklm
oscklmOP16mo ago
Awesome. That's aligns well with the way i'm thinking about it at the moment. So i'm glad to hear i'm not missing out on some nifty convex way of going about it. Thanks Jamie!

Did you find this page helpful?