Title basically 🙂
Here's an example for a
postscollection to get only published documents:
const getPosts = async () => {
const posts = await payload.find({
collection: "posts",
where: {
_status: {
equals: "published",
},
},
});thanks
-> only return published and in with specific where
hey
@779076714797334569, sorry for the late reply on this, you can combine multiple query conditions using
andlike so:
where: {
and: [
_status: {
equals: "published",
},
"group.slug": {
equals: slug,
},
],
}You can also use
oras well, which works the same way. That would return documents that satisfy
eithercondition, wheras
andmust satisfy both/all conditions.
https://payloadcms.com/docs/queries/overview#and-or-logicthanks, I appreciate it
Star
Discord
online
Get dedicated engineering support directly from the Payload team.