简体   繁体   English

mongodb-滥用system.users集合?

[英]mongodb - abuse of system.users collection?

I have a simple mongodb app. 我有一个简单的mongodb应用程序。 Users create accounts when they login. 用户登录时创建帐户。

When a user creates their account I have to store the extra data somewhere. 用户创建帐户时,我必须将额外的数据存储在某个地方。

Currently I'm extending the system.users collection in mongodb and adding a bunch of fields to it. 目前,我正在mongodb中扩展system.users集合,并向其中添加一堆字段。 However it is a 'system' collection so I'm not sure if this is a good idea. 但是,这是一个“系统”集合,因此我不确定这是否是一个好主意。

Is this 'bad practice'? 这是“坏习惯”吗? Should I instead create a user_details collection and map it to the system.users table with the use of the '_id' foreign key style? 我是否应该使用“ _id”外键样式创建一个user_details集合并将其映射到system.users表?

This is definitely a bad idea. 这绝对是一个坏主意。 system.users collection is supposed to store authentication details of users that are allowed to access your database. system.users集合应该存储允许访问数据库的用户的身份验证详细信息。 DB users and app users are two very different entities! 数据库用户和应用程序用户是两个非常不同的实体!

My suggestion: stop messing with system collections. 我的建议是:不要再搞乱系统集合了。 Or else it will surely backfire in the future. 否则将来肯定会适得其反。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM