MongoDB更新到3.0后,Heroku应用程序崩溃

MLy*_*yck 5 heroku mongoose mongodb node.js heroku-toolbelt

MongoDB今天强制我的Heroku服务器上的更新从2.6到3.0

现在我的应用程序在启动后不久崩溃并出现错误:

2015-10-01T10:22:27.405579+00:00 heroku[web.1]: State changed from crashed to starting
2015-10-01T10:22:42.457971+00:00 heroku[web.1]: Starting process with command `node server`
2015-10-01T10:22:46.278159+00:00 app[web.1]: memory, and will not scale past a single process.
2015-10-01T10:22:46.278136+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2015-10-01T10:22:46.278157+00:00 app[web.1]: designed for a production environment, as it will leak
2015-10-01T10:22:47.151118+00:00 app[web.1]: production server running at http://localhost:33827
2015-10-01T10:22:47.463775+00:00 heroku[web.1]: State changed from starting to up
2015-10-01T10:22:47.767430+00:00 app[web.1]: /app/node_modules/mongodb/lib/mongodb/connection/base.js:246
2015-10-01T10:22:47.767437+00:00 app[web.1]:         throw message;
2015-10-01T10:22:47.767439+00:00 app[web.1]:               ^
2015-10-01T10:22:47.767441+00:00 app[web.1]: MongoError: auth failed
2015-10-01T10:22:47.767443+00:00 app[web.1]:     at Object.toError (/app/node_modules/mongodb/lib/mongodb/utils.js:114:11)
2015-10-01T10:22:47.767444+00:00 app[web.1]:     at /app/node_modules/mongodb/lib/mongodb/db.js:1156:31
2015-10-01T10:22:47.767445+00:00 app[web.1]:     at /app/node_modules/mongodb/lib/mongodb/db.js:1890:9
2015-10-01T10:22:47.767447+00:00 app[web.1]:     at Server.Base._callHandler (/app/node_modules/mongodb/lib/mongodb/connection/base.js:448:41)
2015-10-01T10:22:47.767449+00:00 app[web.1]:     at /app/node_modules/mongodb/lib/mongodb/connection/server.js:481:18
2015-10-01T10:22:47.767450+00:00 app[web.1]:     at MongoReply.parseBody (/app/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
2015-10-01T10:22:47.767452+00:00 app[web.1]:     at null.<anonymous> (/app/node_modules/mongodb/lib/mongodb/connection/server.js:439:20)
2015-10-01T10:22:47.767453+00:00 app[web.1]:     at emit (events.js:107:17)
2015-10-01T10:22:47.767455+00:00 app[web.1]:     at null.<anonymous> (/app/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:201:13)
2015-10-01T10:22:47.767456+00:00 app[web.1]:     at emit (events.js:110:17)
2015-10-01T10:22:47.767458+00:00 app[web.1]:     at Socket.<anonymous> (/app/node_modules/mongodb/lib/mongodb/connection/connection.js:439:22)
2015-10-01T10:22:47.767459+00:00 app[web.1]:     at Socket.emit (events.js:107:17)
2015-10-01T10:22:47.767461+00:00 app[web.1]:     at readableAddChunk (_stream_readable.js:163:16)
2015-10-01T10:22:47.767462+00:00 app[web.1]:     at Socket.Readable.push (_stream_readable.js:126:10)
2015-10-01T10:22:47.767463+00:00 app[web.1]:     at TCP.onread (net.js:538:20)
2015-10-01T10:22:48.687613+00:00 heroku[web.1]: Process exited with status 1
2015-10-01T10:22:48.704259+00:00 heroku[web.1]: State changed from up to crashed
Run Code Online (Sandbox Code Playgroud)

我检查了他们的状态页面,发现Mongo已经将他们的服务器更新到3.0版本,但是现在更新应该是稳定的,因此我需要做的就是我的结果.

看了一下之后.我发现我应该安装新的"驱动程序"以与3.0版兼容.

我找到了这个链接http://docs.mongodb.org/manual/release-notes/3.0-scram/#upgrade-drivers

但它没有描述我如何才能更新我的Heroku应用程序上的驱动程序.

我正在使用他们的沙盒服务器.

我试过联系他们的支持,但他们给了我相同的链接.

我也联系了Heroku的支持.但他们所说的只是:

您需要确保您用于Mongo的库支持Mongo的新版本3.0.它不一定是"司机"

这对我也没有帮助.

这是我的package.json的内容,如果这有帮助.

{
  "name": "Stocks",
  "private": true,
  "version": "0.0.1",
  "main": "server.js",
  "engines": {
    "node": "0.12.x",
    "npm": "*"
  },
  "author": "Anom <anom@gmail.com",
  "dependencies": {
    "aws-sdk": "*",
    "body-parser": "^1.10.1",
    "connect": "^3.3.5",
    "connect-flash": "^0.1.1",
    "ejs": "^2.2.1",
    "express": "^4.11.0",
    "express-session": "^1.10.1",
    "forever": "*",
    "grunt": "^0.4.5",
    "grunt-cli": "^0.1.13",
    "grunt-contrib-jshint": "^0.11.2",
    "grunt-contrib-sass": "^0.9.2",
    "grunt-contrib-uglify": "^0.8.1",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-express-server": "^0.5.1",
    "grunt-ssh": "^0.12.3",
    "gulp": "latest",
    "mongoose": "3.8.19",
    "multer": "^0.1.8",
    "node-sass": "^2.1.1",
    "nodemailer": "^1.3.4",
    "passport": "^0.2.1",
    "passport-local": "^1.0.0",
    "postmark": "^1.0.0",
    "request": "^2.55.0",
    "stripe": "^3.3.4"
  },
  "devDependencies": {},
  "scripts": {
    "start": "node server"
  }
}
Run Code Online (Sandbox Code Playgroud)

任何帮助,以了解如何更新我的Heroku应用程序上的驱动程序以与新的3.0 MongoDB兼容将不胜感激.

hun*_*tis 10

你正在使用猫鼬3.8.19.最新版本的mongoose是4.1.9.我会从那里开始:

$ npm install --save --save-exact mongoose@4.1.9
Run Code Online (Sandbox Code Playgroud)

  • `--save`标志为你改变package.json. (2认同)