Consider the below "restaurants" collection documents in the "restaurant" mongodb database.
{
"_id" : ObjectId("55f6564073fc0a09338cf434"),
"address" : {
"building" : "97-22",
"coord" : [
-73.8601152,
40.7311739
],
"street" : "63 Road",
"zipcode" : "11374"
},
"borough" : "Queens",
"cuisine" : "Jewish/Kosher",
"grades" : [
{
"date" : ISODate("2014-11-23T17:30:00.000-06:30"),
"grade" : "Z",
"score" : 20
},
{
"date" : ISODate("2013-01-16T17:30:00.000-06:30"),
"grade" : "A",
"score" : 13
},
{
"date" : ISODate("2012-08-01T17:30:00.000-06:30"),
"grade" : "A",
"score" : 13
},
{
"date" : ISODate("2011-12-14T17:30:00.000-06:30"),
"grade" : "B",
"score" : 25
},
........
.......
.......
{
"date" : ISODate("2011-12-14T17:30:00.000-06:30"),
"grade" : "AZZ",
"score" : 25
}, -- It reaches 15 MB
],
"name" : "Tov Kosher Kitchen",
"restaurant_id" : "40356068"
}
In this document "grades" filed is the embedded document array. This array is going to reach mongodb maximum document size 16Mb. So now we are in the situation to alter the data model for this collection. I came to know that in the mongoDb we can store the documents which exceed the default limit of 16mb by using "gridfs" . I'm not able to find the links to demonstrate this. I need to store gridfs documents along with existing fields in the collection.