'MongoServerError: Nested BSON depth greater than 50 not allowed

I want to update an object key from mongodb. But when i want to update that key, I am getting this error

MongoServerError: Nested BSON depth greater than 50 not allowed
    at Connection.onMessage (C:\Users\Mahabub Saki\Desktop\my-projects\asgmt-11\server-side\node_modules\mongodb\lib\cmap\connection.js:203:30)
    at MessageStream.<anonymous> (C:\Users\Mahabub Saki\Desktop\my-projects\asgmt-11\server-side\node_modules\mongodb\lib\cmap\connection.js:63:60)
    at MessageStream.emit (node:events:390:28)
    at processIncomingData (C:\Users\Mahabub Saki\Desktop\my-projects\asgmt-11\server-side\node_modules\mongodb\lib\cmap\message_stream.js:108:16)
    at MessageStream._write (C:\Users\Mahabub Saki\Desktop\my-projects\asgmt-11\server-side\node_modules\mongodb\lib\cmap\message_stream.js:28:9)
    at writeOrBuffer (node:internal/streams/writable:389:12)
    at _write (node:internal/streams/writable:330:10)
    at MessageStream.Writable.write (node:internal/streams/writable:334:10)
    at TLSSocket.ondata (node:internal/streams/readable:754:22)
    at TLSSocket.emit (node:events:390:28) {
  ok: 0,
  code: 8000,
  codeName: 'AtlasError',
  [Symbol(errorLabels)]: Set(0) {}
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source