使用mongoDB无密码可以吗? [英] Is it Ok to use mongoDB passwordless?

查看:787
本文介绍了使用mongoDB无密码可以吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算将mongodb和连接到它的Windows服务安装到同一台计算机上. 那台机器将处于隔离的网络中.

I am planning to install mongodb and the windows service which is connecting to it to the same machine. That machine will be in isolated network.

当我们这样做时. 可以无密码连接本地mongodb吗?

When we do it like that. Is it ok to connect local mongodb passwordless?

我的计划财产将是这样...

My planned properties will be like this...

private MongoDatabase _db;
public MongoDatabase DB
{
    get
    {
        if (_db == null)
        {
            var mongoServer = MongoServer.Create();
            _db = mongoServer.GetDatabase("myStatistics");
        }
        return _db;
    }
}

private MongoCollection _collection;
public MongoCollection Collection
{
    get { return _collection ?? (_collection = DB.GetCollection("myStats")); }
}

推荐答案

有两个选项:

  1. 可信任环境中的无密码
  2. 密码保护

在受信任的网络中禁用auth的情况下使用MongoDB是可以的. MongoDb开发人员推荐在以下位置运行数据库受信任的环境,而不是专注于身份验证选项.

It's okay to use MongoDB with auth disabled in trusted network. MongoDb developers recommend running the database in trusted environment rather than focusing on auth options.

这篇关于使用mongoDB无密码可以吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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