How to Check if value exist in collection or not using MongoDB Webhook?

I want to check if value exist in Collection or not.
e.g. I have Collection of cart Products, I want to check if that product is already present in Collection then i don’t want to insert product else in insert that product into cart Collection.

Take a look at upsert in https://docs.mongodb.com/drivers/node/fundamentals/crud/write-operations/upsert/