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
Try this, it works:
mongoose.connect('mongodb://localhost:27017/shopping');
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');
}
This is because you are using the connection string in an improper format.
You are using localhost:27017/db/chat
while it should be mongodb://localhost:27017/db/chat
The pattern for the connection string is mongodb://<HOSTNAME>:<PORT>/<DBNAME>
Article for reference: https://mongodb.github.io/node-mongodb-native/api-generated/mongoclient.html#mongoclient-connect