关于mongodb的疑惑 多对多一对多的关系如何表述
伊谢尔伦
伊谢尔伦 2017-04-21 11:17:07
0
1
620

比如,博客类型,一篇文章可以有多条评论。但是如果我有个需求是列出所有的评论呢?比如西贝cnbeta有一个被顶的最火的评论,不是针对于一篇文章而是针对于库里所有文章的评论。这种情形mongodb怎么操作或设计数据库?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
左手右手慢动作

In MongoDB, many-to-many and one-to-many relationships can be implemented in two ways, including

  1. embedded way
  2. reference method

Both methods have their own advantages, disadvantages and applicable scenarios, and users need to apply them according to their own needs

You can refer to this article

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