MongoServerError: Resulting document after update is larger than 16777216
-
Im getting this following error in nodebb
nodebb: 1.19.1
mongodb: 4.4.8(node:92) UnhandledPromiseRejectionWarning: MongoServerError: Resulting document after update is larger than 16777216
(node:92) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 98784)
SB OIDC Token: Error while creating new user token Resulting document after update is larger than 16777216
SB OIDC Token: Error While checkig the tokens MongoServerError: Resulting document after update is larger than 16777216Is there any solution for this issue ?
-
This happens if a document has too much data, mongodb has a limit of 16mb per document. You can run something like below to find which document is the largest.
// biggest object var max = 0; var key = ''; db.objects.find().forEach(function(obj) { var curr = Object.bsonsize(obj); if(max < curr) { max = curr; key = obj._key; } }) print(key); print(max); //execute with: //mongo localhost:27017/<db_name> doc_size.js