【问题标题】:Meteor find an object in MongoDB by _id when it is a numberMeteor 在 MongoDB 中通过 _id 找到一个对象,当它是一个数字时
【发布时间】:2017-02-19 11:45:06
【问题描述】:

我有一个文档插入到带有{ _id : 0, ... } 的集合中,但我无法使用collection.findOne({ _id : 0 }) 找到它,它返回未定义。但是,从 mongo shell 查询它可以正常工作。

【问题讨论】:

    标签: mongodb meteor minimongo


    【解决方案1】:

    如果_id 为0,则需要使用collection.find(0),如果_id 为23123,则需要使用collection.find(23123)

    【讨论】:

      猜你喜欢
      • 2012-09-06
      • 2015-12-03
      • 2016-04-19
      • 1970-01-01
      • 2021-02-20
      • 1970-01-01
      • 2020-12-04
      • 2020-01-14
      • 1970-01-01
      相关资源
      最近更新 更多