QuietRocket
QuietRocket2w ago

Error on .any() field: "Document is too nested"

Hi. I have an .any() field on an object in my Schema. The documentation doesn't mention any limitations. I have JSON objects which are apparently deeply nested. I'm unable to insert one such object, getting the following error: ... isn't a valid document: Document is too nested (nested 18 levels deep > maximum nesting 16) Must I really re-architecture my JSON document representation to always be inferior or equal to 16 levels, or should I just stringify the JSON and store the document as a string, or something else? Thank you
4 Replies
Convex Bot
Convex Bot2w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
erquhart
erquhart2w ago
Recommend stringifying the deeply nested objects if possible.
QuietRocket
QuietRocketOP2w ago
Sounds good. That's the path I took anyway in the mean time. 👍 Might be handy to mention in the docs just in case. I could imagine people using .any then over time their JSON might evolve (or some recursive case might make it too deep) and they'd have to do a migration.
erquhart
erquhart2w ago
Yeah, agree good feedback

Did you find this page helpful?