throw new error_1.MongoParseError(`${optionWord} ${Array.from(unsupportedOptions).join(', ')} ${isOrAre} not supported`);
^
MongoParseError: options preferredcms_db_name, cms_db_collection are not supported
{
"dependencies": {
"mongodb": "^5.1.0"
}
}
假如你和我一样,使用的是mongodb
const { MongoClient } = require('mongodb');
const url = 'mongodb://XXXXXXX';
const client = new MongoClient(url);
const dbName = 'AAAAA';
async function main() {
await client.connect();
console.log('Connected successfully to server');
const db = client.db(dbName);
const collection = db.collection('XXXXXX');
const findResult = await collection.find({}).project({ _id: 'XXXXXXX' }).toArray()
console.log('Found documents =>', findResult);
// the following code examples can be pasted here...
return 'done.';
}
main()
.then(console.log('Connected.'))
.catch(console.error)
.finally(() => client.close());
const mongoose = require('mongoose')
mongoose.connect('mongodb://127.0.0.1:27017/ele-admin')
.then(() => console.log('数据库连接成功'))
.catch(err => console.log('数据库连接失败', err));
step1:去官网对照版本点击这里,直达官网链接
step2:更新本地代码,使用对照版本(经过对照,我应当使用的最大版本号为5.0.0)
step3:重新下载依赖,运行代码
step4:运行代码,成功连接~
今天就写到这里啦~
小伙伴们,( ̄ω ̄( ̄ω ̄〃 ( ̄ω ̄〃)ゝ我们明天再见啦~~
大家要天天开心哦
欢迎大家指出文章需要改正之处~
学无止境,合作共赢