'Check if field exist for a user in firestore collection or not

How do I check if a document in firestore collection contains a certain field or not and create the field if the field hasn't been created already



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source