Ignore Empty Conditions

Override Prisma's default behavior when the OR block is empty.

Project Toolchain Usage

To enable this optional feature, add the ignoreEmptyConditions element to your optionalFeatures array, then use the generated middleware or extension inside of your code.

Feature Effect

Query Input

For this example, we'll pass the following input to an operation on a model:

Test Input
{
    where: {
        id: 2,
        OR: [],
        posts: {
            every: {
                OR: [{ id: 2 }, { id: 3 }]
            }
        }
    }
}

Query Result

The input above will be manipulated and Prisma will receive this input:

Test Output
{
    where: {
        id: 2,
        posts: {
            every: {
                OR: [{ id: 2 }, { id: 3 }]
            }
        }
    }
}

Last updated