简体   繁体   中英

Building a user system with PHP (Code Igniter) and MongoDB

I want to switch from a MySQL database to a Mongo database. Especially the syntax seems more user-friendly, but that's not important right now.

I want to write a user authentication login system which basically verifies the email & password sent by the user agains the database (and acts accordingly). As I'm not extremely familiar with MongoDB and its user system, I was wondering: Should I treat users as 'Documents in a Collection' with db.insert() or should I create actual database users with db.createUser() call?

The first option seems more SQL-like (in a MySQL database, I would create a table called users with according columns), whereas the second option reminds me of users that have access to phpMyAdmin in order to monitor the database, but not users that actually use the application I am building.

I tried searching information on login systems with MongoDB but I couldn't really find anything that confirms or denies my intuitions.

我认为SQL是创建登录系统的最佳选择,但是如果您需要使用MongoDB创建登录系统,则可以创建一个名为user的集合,以及一个名为username和password的字段,这可能有助于您在此处输入链接描述

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