【问题标题】:Does the document in the db have to match the schema exactly in order to populate the queried doc?数据库中的文档是否必须与模式完全匹配才能填充查询的文档?
【发布时间】:2014-03-23 05:17:29
【问题描述】:

我的模型只查询文档的_id。数据库中的文档是否必须与模式完全匹配才能填充查询的文档?例如。如果我的架构是 {FirstName:String, LastName:String} 并且我在 mongo 术语中插入 {FirstName:'Rocky'},我的 Mongoose 查询会只查询 _id 吗?

架构:https://gist.github.com/fourq/5118f6237bf2fcc38a4b

插入数据:https://gist.github.com/fourq/d86d1b7b446f754efa17

查询时返回的内容:https://gist.github.com/fourq/1fbbe6c8126b238a9b02

【问题讨论】:

    标签: mongodb mongoose


    【解决方案1】:

    这是我对如何查询我需要的项目缺乏了解。我解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-18
      • 2023-03-05
      • 2020-08-27
      • 2021-12-06
      • 2014-08-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多