Incomplete key value pair for option remote mongodb

送分小仙女□ 提交于 2019-12-25 02:22:24

问题


I'm trying to deploy my local node mongoDB app to Heroku. Everything is working fine on my local machine, no errors.

First thing I'm trying to do is to connect to a database on mlab. It seen very straight forward but I get this error:

err { MongoParseError: Incomplete key value pair for option
  name: 'MongoParseError',
  message: 'Incomplete key value pair for option',
  [Symbol(mongoErrorContextSymbol)]: {} }

My code looks like this:

    var mongoose = require('mongoose');

    const options = {
            useNewUrlParser: true
          };

    mongoose.connect("mongodb://username:password@xxxxx.mlab.com:39251/nameodDB",options).then(
   ()=>{
      console.log("connected to mongoDB")},
   (err)=>{
       console.log("err",err);
 });

来源:https://stackoverflow.com/questions/51352077/incomplete-key-value-pair-for-option-remote-mongodb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!