MongoDB - Error: invalid schema, expected mongodb

前端 未结 9 2124
悲&欢浪女
悲&欢浪女 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条回答
  •  一向
    一向 (楼主)
    2020-12-13 07:06

    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://:/

    Article for reference: https://mongodb.github.io/node-mongodb-native/api-generated/mongoclient.html#mongoclient-connect

提交回复
热议问题