Home Database Mysql Tutorial [教程]MongoDB 从入门到进阶 (User系统)

[教程]MongoDB 从入门到进阶 (User系统)

Jun 07, 2016 pm 05:38 PM
mongodb user getting Started Tutorial system Advanced

自从MongoDB升级到2.4之后,User系统,或者说是权限系统有了翻天覆地的变化。 在MongoDB2.4之前的User系统,除了用户名和密码之外,只有一个ReadOnly属性。 如果一个用户在admin数据库里面进行了登陆,则admin数据库里面的Readonly属性将被沿用到其他所有的

自从MongoDB升级到2.4之后,User系统,或者说是权限系统有了翻天覆地的变化。

在MongoDB2.4之前的User系统,除了用户名和密码之外,只有一个ReadOnly属性。

如果一个用户在admin数据库里面进行了登陆,则admin数据库里面的Readonly属性将被沿用到其他所有的数据库。

这样的权限管理当然是最最容易管理的,任何能够登入到MongoDB的用户,如果在Admin的数据库的用户表里面存在记录,则对于整个服务器上的所有数据库的访问权限也就固定下来了。

当然,用户可以了在个别的数据库的用户表中定义自己的权限。所谓的权限也就是只读或者非只读。

到了2.4之后,MongoDB的用户模型发生了很大的变化

MongoUser(2.4之前)

用户名

密码

是否只读

MongoUser(2.4之后)

用户名

密码

角色

其他数据库角色(如果该用户在Admin数据库的User表里面登陆的话,可以个别指定对于具体数据库访问的权限)

外部验证

“角色”这个概念,也“是否只读”比起来,内容丰富多了,不同的角色可以进行的操作是不同的,有的可以管理用户,看得到用户表,有的只能看到普通的数据表。

最近一直在对用户和权限进行研究,总结了一下心得:

1.由于要顾及以前的版本,ReadOnly属性还是可以使用的,不过,ReadOnly和Role是不能共存的

2.密码和外部验证,也是不能共存的,要么用密码验证身份,要么用外部验证数据库来验证身份

3.其他数据库角色只能在Admin里面进行登录。

接下来说说坑爹的C#的驱动程序:C#的驱动程序,对于MongoUser的巨大变化,还没有开始进行对应。自己动手丰衣足食,我现在的开发都是使用自己改写的MongoUser类。

我不是很明白,为什么C#驱动不对应MongoUser的变化,我也不清楚其他语言的驱动程序是否也没有对应。。。。

这里是新的添加用户的GUI

添加了用户后,请不要忘记在启动MongoDB的时候加上 --auth的参数,不然的话,默认是不会启动认证的,不管是谁,都是完全的Admin的权限。

如果对于我的GUI工具感兴趣,Github上面有所有的代码

https://github.com/magicdict/MagicMongoDBTool

这次工具开始尝试提供性能监视工具,当然,只是一个小的尝试罢了。

再说几句题外话,最近IBM宣布和10gen(MongoDB的开发公司)进行合作。我不知道IBM准备多大限度的支持MongoDB。但是不管怎么说,,对于MongoDB的爱好者来说,是一个不错的消息。

MongoDB现在还是冷门的数据库。园子里面也少有介绍MongoDB的文章,或者即使介绍,也是入门级别的。

技术就像赌博一样,谁知道明年的这个时候,Mongo是不是会大红大紫,成为另一个Oracle。不管怎么样,先投资一下吧。。。。。

想要直接体验工具的:   Net3.5是必须的。。。。

 

 

 

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Huawei's Qiankun ADS3.0 intelligent driving system will be launched in August and will be launched on Xiangjie S9 for the first time Jul 30, 2024 pm 02:17 PM

On July 29, at the roll-off ceremony of AITO Wenjie's 400,000th new car, Yu Chengdong, Huawei's Managing Director, Chairman of Terminal BG, and Chairman of Smart Car Solutions BU, attended and delivered a speech and announced that Wenjie series models will be launched this year In August, Huawei Qiankun ADS 3.0 version was launched, and it is planned to successively push upgrades from August to September. The Xiangjie S9, which will be released on August 6, will debut Huawei’s ADS3.0 intelligent driving system. With the assistance of lidar, Huawei Qiankun ADS3.0 version will greatly improve its intelligent driving capabilities, have end-to-end integrated capabilities, and adopt a new end-to-end architecture of GOD (general obstacle identification)/PDP (predictive decision-making and control) , providing the NCA function of smart driving from parking space to parking space, and upgrading CAS3.0

Generate PPT with one click! Kimi: Let the 'PPT migrant workers' become popular first Generate PPT with one click! Kimi: Let the 'PPT migrant workers' become popular first Aug 01, 2024 pm 03:28 PM

Kimi: In just one sentence, in just ten seconds, a PPT will be ready. PPT is so annoying! To hold a meeting, you need to have a PPT; to write a weekly report, you need to have a PPT; to make an investment, you need to show a PPT; even when you accuse someone of cheating, you have to send a PPT. College is more like studying a PPT major. You watch PPT in class and do PPT after class. Perhaps, when Dennis Austin invented PPT 37 years ago, he did not expect that one day PPT would become so widespread. Talking about our hard experience of making PPT brings tears to our eyes. "It took three months to make a PPT of more than 20 pages, and I revised it dozens of times. I felt like vomiting when I saw the PPT." "At my peak, I did five PPTs a day, and even my breathing was PPT." If you have an impromptu meeting, you should do it

AI in use | AI created a life vlog of a girl living alone, which received tens of thousands of likes in 3 days AI in use | AI created a life vlog of a girl living alone, which received tens of thousands of likes in 3 days Aug 07, 2024 pm 10:53 PM

Editor of the Machine Power Report: Yang Wen The wave of artificial intelligence represented by large models and AIGC has been quietly changing the way we live and work, but most people still don’t know how to use it. Therefore, we have launched the "AI in Use" column to introduce in detail how to use AI through intuitive, interesting and concise artificial intelligence use cases and stimulate everyone's thinking. We also welcome readers to submit innovative, hands-on use cases. Video link: https://mp.weixin.qq.com/s/2hX_i7li3RqdE4u016yGhQ Recently, the life vlog of a girl living alone became popular on Xiaohongshu. An illustration-style animation, coupled with a few healing words, can be easily picked up in just a few days.

Huawei will launch the Xuanji sensing system in the field of smart wearables, which can assess the user's emotional state based on heart rate Huawei will launch the Xuanji sensing system in the field of smart wearables, which can assess the user's emotional state based on heart rate Aug 29, 2024 pm 03:30 PM

Recently, Huawei announced that it will launch a new smart wearable product equipped with Xuanji sensing system in September, which is expected to be Huawei's latest smart watch. This new product will integrate advanced emotional health monitoring functions. The Xuanji Perception System provides users with a comprehensive health assessment with its six characteristics - accuracy, comprehensiveness, speed, flexibility, openness and scalability. The system uses a super-sensing module and optimizes the multi-channel optical path architecture technology, which greatly improves the monitoring accuracy of basic indicators such as heart rate, blood oxygen and respiration rate. In addition, the Xuanji Sensing System has also expanded the research on emotional states based on heart rate data. It is not limited to physiological indicators, but can also evaluate the user's emotional state and stress level. It supports the monitoring of more than 60 sports health indicators, covering cardiovascular, respiratory, neurological, endocrine,

Another Sora-level player is coming to hit the streets! We compared it with Sora and Keling. Another Sora-level player is coming to hit the streets! We compared it with Sora and Keling. Aug 02, 2024 am 10:19 AM

When Sora failed to come out, OpenAI's opponents used their weapons to destroy the streets. If Sora is not open for use, it will really be stolen! Today, San Francisco startup LumaAI played a trump card and launched a new generation of AI video generation model DreamMachine. Free and available to everyone. According to reports, the model can generate high-quality, realistic videos based on simple text descriptions, with effects comparable to Sora. As soon as the news came out, a large number of users crowded into the official website to try it out. Although officials claim that the model can generate 120-frame video in just two minutes, many users have been waiting for hours on the official website due to a surge in visits. BarkleyDai, Luma’s head of product growth, had to comment on Discord

Why didn't I know when I was learning line generation: There is an equivalence relationship between matrices and graphs? Why didn't I know when I was learning line generation: There is an equivalence relationship between matrices and graphs? Aug 19, 2024 pm 04:52 PM

The matrix is ​​difficult to understand, but it may be different if you look at it from another perspective. When learning mathematics, we are often frustrated by the difficulty and abstractness of the knowledge we learn; but sometimes, just by changing the perspective, we can find a simple and intuitive solution to the problem. For example, when we were learning the formula for the sum of squares (a+b)² when we were children, we may not understand why it is equal to a²+2ab+b². We only knew that it was written like this in the book and the teacher asked us to remember it like this; until one day we saw I saw this animated picture: It suddenly dawned on me that we can understand it from a geometric perspective! Now, this sense of enlightenment occurs again: a non-negative matrix can be equivalently converted into the corresponding directed graph! As shown in the figure below, the 3×3 matrix on the left can actually be

How to transfer coins to Binance? How to mention the crypto assets in HTX to the Binance platform? How to transfer coins to Binance? How to mention the crypto assets in HTX to the Binance platform? Mar 03, 2025 pm 08:51 PM

Huobi to Binance Transfer Guide: Safe and conveniently transfer your crypto assets Many investors use Huobi and Binance at the same time. This article will guide you how to safely transfer crypto assets on Huobi (HTX), such as TRUMP and USDT, to the Binance platform. Binance is popular for its high security, rich currency and trading pairs, and world-leading trading volume. Binance Exchange’s advantages: the world’s number one trading volume, accounting for 50% of the global market; transparent reserve assets are mainly mainstream stablecoins such as Bitcoin, Ethereum and USDT; it has effectively avoided the potential risks of the US SEC and is one of the most stable and reliable exchanges at present. This tutorial will take TRUMP and USDT as examples

How to ensure high availability of MongoDB on Debian How to ensure high availability of MongoDB on Debian Apr 02, 2025 am 07:21 AM

This article describes how to build a highly available MongoDB database on a Debian system. We will explore multiple ways to ensure data security and services continue to operate. Key strategy: ReplicaSet: ReplicaSet: Use replicasets to achieve data redundancy and automatic failover. When a master node fails, the replica set will automatically elect a new master node to ensure the continuous availability of the service. Data backup and recovery: Regularly use the mongodump command to backup the database and formulate effective recovery strategies to deal with the risk of data loss. Monitoring and Alarms: Deploy monitoring tools (such as Prometheus, Grafana) to monitor the running status of MongoDB in real time, and

See all articles