开发者

MongoDB AND SQL Server

I'm working on a project where some objects are best suited for a document database. We chose mongoDO, which I really like.

The questio开发者_如何学运维n is, how are people representing child objects that are in a document but are actually in SQL?

For example, if my "user" object is in SQL, and my order object is in mongo

Class order { User user; DateTime dateCreated; double Price; }

Should I just store the userId?

Thanks in advance!


You probably want to store its ID.

You might also want to store some of the attributes of the user so you don't have to look up what's in the SQL DB... for example a shipping address is a good choice to store here since even if the user a couple of days later changes his shipping address you still want to have the old address here.

Don't store the attributes which you have to refresh when they change.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜