-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Hi there, this package is amazing. We're looking to implement it within Payload and we're currently stuck on an issue.
We have a JSON column that stores a JSON array at the root, like this:
[
{
"children": [
{
"text": "hello"
}
]
},
{
"children": [
{
"text": "i am some"
},
{
"bold": true,
"text": "SlateJS rich text"
}
]
}
]As you can see, the root of the JSON stored in our jsonb column is an array. We were hoping to use the true value for arrayFields, so that all paths would be checked as arrays accordingly (or at the very least, the root and any children property).
But it appears that the true argument never makes its way into the convert method, as it is currently stripped out immediately when this package is invoked, within this code:
module.exports = function (fieldName, query, arraysOrOptions) {
let arrays
let options = {}
if (arraysOrOptions && Array.isArray(arraysOrOptions)) {
arrays = arraysOrOptions
} else if (typeof arraysOrOptions === 'object') {
arrays = arraysOrOptions.arrays || []
options = arraysOrOptions
}
return convert([fieldName], query, arrays || [], false, options)
}So I've discovered a potential problem there. But I've also got an overarching question in general - how would we query the column as if the column root itself were an array? I tried all sorts of things but I don't think the package is currently set up to work this way.
Thank you!