Hello,
If we have a DB model as
{
name: string;
quantity: number;
status: string;
}
Is it possible to write an updateOne query with upsert true, so that
- If filter doesn’t match name, it will insert a new entry with name, status and quantity.
- If filter does match and status is ‘PROCESSED’ it will NOT perform any update
- If filter does match and status is NOT ‘PROCESSED’ it will update the quantity
I’m struggling with points 2 and 3.
Thank’s for the help.