I am building an APP that will allow users to create an account. After registration, a verification email will be sent to their email address containing a 6 digit code that they will have to input in order to verify their account.
The question is, prior to their account being verified, where do I put this document in my database? Do I put it in a separate collection or do I put it in the regular users collection with a flag to indicate that this use is not verified?
It can certainly work either way.
I expect keeping them in the same collection would be the most common approach. However if you expect to have a huge number of unverified users or may grow your verification approach to require more complex data you may benefit from using different collections.
I think the best general advice is to keep it simple until you have a clear reason to add complexity. Then you can design for that known shortcoming in your simple solution. In this case having a single user collection would be the simpler approach, as you avoid having to move verified users to a new collection.