How to check document exists or not?

have you tried to use a count if returns 0 then there is no document …
W