I would like to store ticket details in an array in a mongo document. it works fine till the document size reaches 16MB, after that I get the exception (Resulting document after update is larger than 16777216) and program terminates abruptly. I cannot split this document coz it stores all the ticket details falls under that year 2016.
here goes my document structure.
{
year:2016,
purpose: ticketdetail,
tickets:[
{ticketid:001, desc:"xyz", created:20161231},
{ticketid:002, desc:"xyz", created:20161231},
{ticketid:003, desc:"xyz", created:20161231},
.......
.......
{ticketid:00N, desc:"xyz", created:20161231},
}]
}
You will need to split your document into separate documents, perhaps in a different collection. I would not recommend GridFS, because you cannot query data within a GridFS blob.
Here is a suggested document structure:
{
_id: ObjectId("85bf0ef0b9692c0010978359"),
"ticketid" : "001",
"desc" : "xyz",
"created" : ISODate("2016-12-31T00:00:00.000Z")
}
,
{
_id: ObjectId("85bed4257726f90010d4e21f"),
"ticketid" : "002",
"desc" : "xyz",
"created" : ISODate("2016-12-31T00:00:00.000Z")
}
Notes on this structure:
db.tickets.find({
"created" : {
$gte: ISODate("2016-01-01"),
$lt: ISODate("2017-01-01")
}
}
});