MongoDB - Error: invalid schema, expected mongodb

前端 未结 9 2134
悲&欢浪女
悲&欢浪女 2020-12-13 05:59

I\'m new in building application with MEAN Stack, I\'m trying to build a real time chat app, here is my server side :

console.log(\"Server running...!\");

v         


        
9条回答
  •  旧时难觅i
    2020-12-13 06:58

    Just figured out the same problem. Damned windows save quotes in environment.

    So if you use windows and wrote this way SET MONGO_URL="mongodb://localhost:27017/{name of your db}" It is not correct.

    Correct way is SET MONGO_URL=mongodb://localhost:27017/{name of your db} without quotes.

    Also i discovered that you must write protocol exactly - mongodb. There is code what check the protocol from file url_parser.js

    var result = parser.parse(url, true);
    
    if(result.protocol != 'mongodb:') {
        throw new Error('invalid schema, expected mongodb');
    }
    

提交回复
热议问题