mongodb存放关系好还是直接存数据好?
为情所困
为情所困 2017-04-28 09:06:33
0
4
808

比方说每条数据需要相关用户的信息,是存放user_id,每次读取时都去获取最新的用户信息,还是直接存放user对象的实际数据?

是时间换空间,还是空间换时间?

好纠结啊,大家一般怎么操作?

为情所困
为情所困

reply all(4)
迷茫

If the user information will be updated, the user_id must be stored and then obtained separately (usually it has been obtained when the user logs in and cooperates with redis for storage calls). Also, do not ignore the storage read speed of mongodb. This is mongodb The advantage lies in. Personally speaking, all my projects store users separately and then call them through user id. for reference only.

淡淡烟草味

It is indeed difficult to measure with a standard

If you want to combine multiple tables, it will be a bit troublesome because it is an asynchronous operation.

If you change relatively mundane data, use ID to associate it

曾经蜡笔没有小新

Most of the time, user_id is stored, which is easier to manage

漂亮男人

Of course you save the ID. Logically speaking, if the user logs out/is deleted/reported/has illegal content, but what you save is the actual data, how do you modify it then?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template