search

Home  >  Q&A  >  body text

关于mongodb的疑惑 多对多一对多的关系如何表述

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

伊谢尔伦伊谢尔伦2804 days ago606

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-04-21 11:19:07

    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

    reply
    0
  • Cancelreply