MongoDB empty string value vs null value

前端 未结 3 1280
隐瞒了意图╮
隐瞒了意图╮ 2021-02-04 01:17

In MongoDB production, if a value of a key is empty or not provided (optional), should I use empty string value or should I use null for value.

1) Is there any pros vs c

3条回答
  •  温柔的废话
    2021-02-04 01:44

    i would say that null indicates absence of the value and empty string indicates that the value is there, but its empty. While reading the data you can distinguish between blank values and non-existing values. Still it depends upon your use-case

提交回复
热议问题