Hi Anthony,
the general idea is this.
- create a query to find items in the collection that have same email
- create a query to find items in the collection that have same number
- create a query to find items in the collection that have same name
- use the query or() operator to combine the queries into a single one.
- now run the combined query’s count() operation to count the number of duplicate items in the collection
- in the then() part of the count operation, do a check:
– if the count is zero, it means there are no dups. return the original item to resolve the promise.
– else, it means there are dups. reject the promise to abort the insert operation.
I hope this will guide you through it, if you find it too high level let me know.
thanks and good luck!