How to enforce foreign keys in NoSql databases (MongoDB)?

后端 未结 6 664
暗喜
暗喜 2020-11-28 15:31

Let\'s say I have a collection of documents such as:

{ \"_id\" : 0 , \"owner\":0 \"name\":\"Doc1\"},{ \"_id\" : 1 , \"owner\":1, \"name\":\"Doc1\"}, etc
         


        
6条回答
  •  情歌与酒
    2020-11-28 16:10

    If someone really wants to enforce the Foreign keys in the Project/WebApp. Then you should with a MixSQL approach i.e. SQL + NoSQL

    I would prefer that the Bulky data which doesn't have that much references then it can be stored in NoSQL database Store. Like : Hotels or Places type of data.

    But if there is some serious things like OAuth modules Tables, TokenStore and UserDetails and UserRole (Mapping Table) etc.... then you can go with SQL.

提交回复
热议问题