I'm making my own custom validation logic (i.e. not using collection2, etc). I can easily validate documents on .before.insert and .before.update by checking the document, then simply returning false if validation fails.
But with .before.upsert the handler function doesn't have a doc arg. How might I be able to validate the documents added or the document inserted in an upsert?
I'm making my own custom validation logic (i.e. not using collection2, etc). I can easily validate documents on
.before.insert
and.before.update
by checking the document, then simply returning false if validation fails.But with
.before.upsert
the handler function doesn't have adoc
arg. How might I be able to validate the documents added or the document inserted in an upsert?