{
"Parentnode": {}
}
{
"Parentnode": {"n1":"abc","n2":"xyz"}
}
i have one key “parentnode” in mongo db. which can have data and could be nothing also. so should i keep {} or null.
yours sincerely.
{
"Parentnode": {}
}
{
"Parentnode": {"n1":"abc","n2":"xyz"}
}
i have one key “parentnode” in mongo db. which can have data and could be nothing also. so should i keep {} or null.
yours sincerely.
Mongo DB have a flexible schema. Even if you haven’t or forgot to define a key in your data model it will accept when you will insert the data it will accept it. The format should only be followed by the key you have specified in yours schema.
question was which one is better , null or {}
My preference would be in order