I'm using MongoDB for the first time on a project, and I'm not quite sure what is the recommended approach for blank/unset values in a document. Which of these two approaches is more appropriate when you have pairs that will likely have values in the future:
1) The JSON where the description field is an empty string (and will be populated in the future):
{
"username": "jamies",
"shortName": "camping",
"setName": "Camping on Stevens",
"description": ""
}
2) Or, the JSON where the description field is omitted (and will be added in the future):
{
"username": "jamies",
"shortName": "camping",
"setName": "Camping on Stevens"
}
Obviously the 2nd approach will save disk space, but also doesn't indicate what values are null. I'd love to understand which is recommended/prescribed by Mongo developers/DBAs, and if there are any considerations with that approach during query or update.