简体   繁体   中英

mongodb - abuse of system.users collection?

I have a simple mongodb app. 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. 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?

This is definitely a bad idea. system.users collection is supposed to store authentication details of users that are allowed to access your database. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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