【问题标题】:How to stop removing document having embedded document gets the original document from another collection removed as well?如何停止删除具有嵌入文档的文档也会从另一个集合中删除原始文档?
【发布时间】:2017-10-30 08:10:40
【问题描述】:

我有 Notification 和 NotificationQueue。 NotificationQueue 有一个 Notification 作为嵌入文档。删除 NotificationQueue 会导致原始通知也被删除。如何阻止原始通知被删除?

【问题讨论】:

    标签: mongodb doctrine


    【解决方案1】:

    您需要将所有 NotificationQueue 文档转换为保存通知 ID,而不是嵌入通知。它更安全,当您查询它们时加载速度更快。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-24
      • 2018-08-08
      • 2017-04-11
      • 1970-01-01
      相关资源
      最近更新 更多