{
"_id" : ObjectId("5a0e77f4b7368f14c088f542"),
"folderName" : "team 4",
"tag" : "search",
"ismainFolder" : true,
"innerFolder" : [
{
parentfolderId" : null,
"ismainFolder" : false,
"foldername" : "Onkar 11"
"subinnerFolder" : [
{
"parentfolderId" : null,
"ismainFolder" : false,
"foldername" : "Onkar 11"
"thirdSubFolder" : [
{
"parentfolderId" : null,
"ismainFolder" : false,
"foldername" : "Onkar 11"
},
{
"parentfolderId" : null,
"ismainFolder" : false,
"foldername" : "Onkar 11"
}
]
},
]
},
]
}
I need to create the mongodb schema for below json format so that innerFolder, subinnerFolder, etc (inner folder structure goes nested) so please help me in this ?
Here is an example of schema in Mongoose style.
The only difficulty here is with null value.
One of your possibility is to store it as text, but consider to do not store null value at all.