My question is about databases pattern (in my case mongo)
is it a good pattern to type, using an empty field ?
for example I have a text object:
- id: id
- text: string
- commentId: id
if comment is empty than it's not a comment it's a answer
But I think this one is better:
- id: id
- text: string
- commentId: id
- type : ['comment', 'answer']
I my opinion, this is a pattern because it only use commentId for what it is, a storage for id and not a typing variable.
What is your opinion ?
Aucun commentaire:
Enregistrer un commentaire