Object.prototype.asafd = function(){}报错,扩展任意方法都报错,之所以扩展Object.prototype是为了兼容客户端代码。
错误如下:
TypeError: Object function (expr){
} has no method ‘onOpen’ at open (/var/node_modules/mongoose/lib/connection.js:313:27) at NativeConnection.Connection.onOpen (/var/node_modules/mongoose/lib/connection.js:322:5) at Connection.open (/var/node_modules/mongoose/lib/connection.js:198:12) at Db.open (/var/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:258:14) at Server.connect.connectCallback (/var/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:230:7) at g (events.js:185:14) at EventEmitter.emit (events.js:115:20) at Db._callHandler (/var/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1396:25) at Server.connect.connectionPool.on.server._serverState (/var/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:421:30) at MongoReply.parseBody (/var/node_modules/mongoose/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:127:5)