Hey
@691568994246983690,
Can you try this:
const result = await payload.find({
collection: 'posts',
where: {
scheduledActions: { equals: [] },
},
limit: 10000,
depth: 0,
})I can't remember exactly the way to do this but we can figure it out here with a few trial and errors
"not_equals: []" seems to work. Have a try on documents, where the array is not yet defined.
OH, sorry you mentioned
"Not Equals"and I read this as "equals" accidentally
My mistake, but glad you figured it out in the end
This works ^ because MongoDB can accept that value, generally, for now there's no any payload "official" way that works in all database adapters and guaranteed to not break in the future
I guess an adapter agnostic way would be a distinct operator here?
Maybe something like
scheduledActions._length: { equals: 0 }Since I use mongodb, im fine with the specific solution. Thank you.
Just wondering, why the "old syntax" doesn't work anymore.
scheduledActions._length throws the same error
scheduledActions._lengthis just my imagination for a possible in the future official way to do this
The old syntax doesn't work anymore probably because we expect
0as a field defined in the payload config now
Got it. Thanks again 🙂
Star
Discord
online
Get dedicated engineering support directly from the Payload team.