【问题标题】:MongoDB Compass - document does not show field with Object ID referenced (Ref) from another collectionMongoDB Compass - 文档不显示来自另一个集合的对象 ID 引用(Ref)的字段
【发布时间】:2020-10-10 18:19:26
【问题描述】:

在 MongoDB 中,我在文档中有一个字段,如下所示:

curOrg: { type: mongoose.Schema.Types.ObjectId, ref: "Org" },

此字段存在并且在我的代码中按预期工作,但是,如果我打开 MongoDB Compass,则该字段不存在于文档中。

有谁知道为什么,或者我需要做什么才能使该字段显示在 MongoDB Compass 中,好吗?谢谢!

【问题讨论】:

    标签: mongodb mongodb-compass


    【解决方案1】:

    我想出了问题所在。问题不在于 MongoDB Compass,而是 'fawn' 用于事务的实际 mongoDB 驱动程序。在那里,当我“添加”一个新字段以及更新其他几个字段时,小鹿任务更新不起作用。如果我将“添加”字段任务与更新其他字段分开,则该字段会正确添加,并且它会正确显示在 MongoDB Compass 中。

    【讨论】:

      猜你喜欢
      • 2015-06-12
      • 1970-01-01
      • 2017-05-06
      • 2017-10-17
      • 2020-03-21
      • 2021-02-22
      • 2023-02-11
      • 2014-03-19
      • 1970-01-01
      相关资源
      最近更新 更多