mirror of
https://github.com/alwxkxk/soft-and-hard.git
synced 2025-01-14 06:12:52 +08:00
fix: demo2添加可能会出现localhost报错的说明。
This commit is contained in:
parent
142abada34
commit
0ef4d279f9
@ -1,8 +1,12 @@
|
||||
// https://github.com/mongodb/node-mongodb-native
|
||||
const MongoClient = require('mongodb').MongoClient;
|
||||
|
||||
// Connection URL
|
||||
|
||||
const url = 'mongodb://localhost:27017';
|
||||
// NOTE:注意,部分网友会报错误: MongoNetworkError : failed to connect to server [localhost:270171] on first [Error:ECONNREFUSED ::1:27017]
|
||||
// 网友怀疑是nodejs版本过高导致的,换成低版本就正常。也可以替换成以下代码也能正常运行:
|
||||
// const url = 'mongodb://127.0.0.1:27017';
|
||||
|
||||
// Database Name
|
||||
const dbName = 'demo2';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user