authSource在mongo数据库URL中是什么意思? [英] What does authSource means in mongo database url?

查看:3395
本文介绍了authSource在mongo数据库URL中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下连接字符串连接到我的mongo数据库

i am trying to connect to my mongo database with following connection string

var Mongo_url = 'mongodb://MyUSer:tech@localhost:27017/chatme?authSource=admin';  

我收到错误消息

 assertionError: null == { [MongoError: Authentication failed.]
 name: 'MongoError',
 message: 'Authentication failed.',
 ok: 0,
 code: 18,

任何人都可以向我清除此"authSource = admin"问题.

Could anyone please clear this "authSource=admin" thing to me.

推荐答案

这是具有用户凭据集合的数据库的名称.

This is the name of the database that has the collection with the user credentials.

https://docs.mongodb.com/manual /reference/connection-string/#connections-connection-options

在此设置用户名和密码.

This is where the usernames and passwords are set up.

这篇关于authSource在mongo数据库URL中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆