Limit nesting on nested docs plugin #12438
Replies: 3 comments
-
I've been looking for a way to achive this as well. I was hoping I could do it with |
Beta Was this translation helpful? Give feedback.
-
Best I could do is this thing: createParentField('categories', {
name: 'parentCategory',
filterOptions: (args) => {
const noLoopsWhere: Where = {
id: { not_equals: args.id },
'breadcrumbs.doc': { not_in: [args.id] },
}
const depthQueryKey = (new Array(MAX_CATEGORY_DEPTH - 1)).fill('parentCategory').join('.')
const where: Where = {
...noLoopsWhere,
[depthQueryKey]: { exists: false }
}
return where
},
}), Which works, but is nowhere near as readable than e.g. made up syntax |
Beta Was this translation helpful? Give feedback.
-
It can become quite the expenseive query depending on how deep you wanna go, so I think I'll maintain my own |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, is there a way to limit the nested docs plugin to x nested docs? A field for this would help prevent deep nesting.
For example, max /slug-1/slug-2/slug-3
anything after would throw an error
Beta Was this translation helpful? Give feedback.
All reactions