I am using mongodb-3.6.0.
我用mongodb-3.6.0。
My express code is
我的表达代码是
var promise = mongoose.connect('mongodb://localhost/myapp', {
useMongoClient: true
});
On running the app I am getting the options [useMongoClient] is not supported
. My mongoose version in ^5.0.0-rc0
.
在运行应用程序时,我得到了选项[useMongoClient]不受支持。我的猫鼬版本^ 5.0.0-rc0。
Please help.
请帮助。
3 个解决方案
#1
5
There is not much documentation about this yet as Mongoose 5 is in release candidate stage but with mongoose 5 you don't need to provide useMongoClient option. Mongoose 5 is using Mongo client by default. So just remove this option.
关于这一点没有太多的文档,因为Mongoose 5正在发布候选阶段,但是在Mongoose 5中,您不需要提供useMongoClient选项。Mongoose 5在默认情况下使用Mongo客户端。所以移除这个选项。
#2
0
mongoose 5 doesn't require useMongoClient anymore.
猫鼬5不再需要我们的客户了。
mongoose.connect('mongodb://localhost/DB_name');
is enough. You can check for the documentation of "Mongoose 5" here
就足够了。您可以在这里查看“Mongoose 5”的文档。
#3
0
const mongoose = require('mongoose');
mongoose.connect('mongodb://127.0.0.1:27017/qunar', { useMongoClient: true });
mongoose.Promise = global.Promise;
module.exports = mongoose
answer:☟
答:☟
Delete the first line of code { useMongoClient: true }
and then restart the server
删除第一行代码{useMongoClient: true}然后重新启动服务器。
#1
5
There is not much documentation about this yet as Mongoose 5 is in release candidate stage but with mongoose 5 you don't need to provide useMongoClient option. Mongoose 5 is using Mongo client by default. So just remove this option.
关于这一点没有太多的文档,因为Mongoose 5正在发布候选阶段,但是在Mongoose 5中,您不需要提供useMongoClient选项。Mongoose 5在默认情况下使用Mongo客户端。所以移除这个选项。
#2
0
mongoose 5 doesn't require useMongoClient anymore.
猫鼬5不再需要我们的客户了。
mongoose.connect('mongodb://localhost/DB_name');
is enough. You can check for the documentation of "Mongoose 5" here
就足够了。您可以在这里查看“Mongoose 5”的文档。
#3
0
const mongoose = require('mongoose');
mongoose.connect('mongodb://127.0.0.1:27017/qunar', { useMongoClient: true });
mongoose.Promise = global.Promise;
module.exports = mongoose
answer:☟
答:☟
Delete the first line of code { useMongoClient: true }
and then restart the server
删除第一行代码{useMongoClient: true}然后重新启动服务器。