{"action":"closed","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/3890","repository_url":"https://api.github.com/repos/Automattic/mongoose","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/3890/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/3890/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/3890/events","html_url":"https://github.com/Automattic/mongoose/issues/3890","id":134561095,"number":3890,"title":"update and $push causes RangeError: Maximum call stack size exceeded","user":{"login":"aartiles","id":92608,"avatar_url":"https://avatars.githubusercontent.com/u/92608?v=3","gravatar_id":"","url":"https://api.github.com/users/aartiles","html_url":"https://github.com/aartiles","followers_url":"https://api.github.com/users/aartiles/followers","following_url":"https://api.github.com/users/aartiles/following{/other_user}","gists_url":"https://api.github.com/users/aartiles/gists{/gist_id}","starred_url":"https://api.github.com/users/aartiles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aartiles/subscriptions","organizations_url":"https://api.github.com/users/aartiles/orgs","repos_url":"https://api.github.com/users/aartiles/repos","events_url":"https://api.github.com/users/aartiles/events{/privacy}","received_events_url":"https://api.github.com/users/aartiles/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Automattic/mongoose/milestones/93","html_url":"https://github.com/Automattic/mongoose/milestones/4.4.6","labels_url":"https://api.github.com/repos/Automattic/mongoose/milestones/93/labels","id":1600857,"number":93,"title":"4.4.6","description":"","creator":{"login":"vkarpov15","id":1620265,"avatar_url":"https://avatars.githubusercontent.com/u/1620265?v=3","gravatar_id":"","url":"https://api.github.com/users/vkarpov15","html_url":"https://github.com/vkarpov15","followers_url":"https://api.github.com/users/vkarpov15/followers","following_url":"https://api.github.com/users/vkarpov15/following{/other_user}","gists_url":"https://api.github.com/users/vkarpov15/gists{/gist_id}","starred_url":"https://api.github.com/users/vkarpov15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkarpov15/subscriptions","organizations_url":"https://api.github.com/users/vkarpov15/orgs","repos_url":"https://api.github.com/users/vkarpov15/repos","events_url":"https://api.github.com/users/vkarpov15/events{/privacy}","received_events_url":"https://api.github.com/users/vkarpov15/received_events","type":"User","site_admin":false},"open_issues":19,"closed_issues":5,"state":"open","created_at":"2016-02-23T19:29:55Z","updated_at":"2016-03-02T17:38:26Z","due_on":"2016-03-02T08:00:00Z","closed_at":null},"comments":1,"created_at":"2016-02-18T12:02:04Z","updated_at":"2016-03-02T17:38:26Z","closed_at":"2016-03-02T17:38:26Z","body":"update and $push causes error `RangeError: Maximum call stack size exceeded` when the model has  embedded documents array with a property of type `Buffer`.\r\n\r\nTest Case:\r\n```\r\n'use strict';\r\nvar mongoose = require('mongoose');\r\nvar Schema = mongoose.Schema;\r\n\r\nvar InfoSchema = new Schema({\r\n  prop: {type: Buffer}\r\n});\r\n\r\nvar ModelASchema = new Schema({\r\n  info_list: {type : [InfoSchema]}\r\n});\r\n\r\nvar ModelA = mongoose.createConnection('mongodb://localhost/test').model('ModelA', ModelASchema);\r\n\r\nvar propValue = new Buffer('aa267824dc1796f265ab47870e279780', 'base64');\r\n\r\nModelA.update(\r\n  {\r\n    _id: '55bba9056e17802c454af434'\r\n  },\r\n  {\r\n    $push: {\r\n      info_list: { prop: propValue }\r\n    }\r\n  },\r\n  function(err) {\r\n    if (err) console.log('Error', err);\r\n    console.log('done!');\r\n    process.exit();\r\n  }\r\n);\r\n```\r\n\r\nStack trace:\r\n```\r\nnode_modules/mongoose/lib/utils.js:0\r\n(function (exports, require, module, __filename, __dirname) { /*!\r\n^\r\nRangeError: Maximum call stack size exceeded\r\n```\r\n\r\nJust changing the `prop` type to `String` makes it work\r\n```\r\nvar InfoSchema = new Schema({\r\n  prop: {type: String}\r\n});\r\n```\r\n\r\n\r\nIt fails with mongoose 4.4.4. It has been working until 4.1.2.\r\nnode version: 0.10.24\r\nmongodb: 2.6\r\n"}}