【问题标题】:Unable to search for a specific date inside mongodb using MongoDB Compass无法使用 MongoDB Compass 在 mongodb 中搜索特定日期
【发布时间】:2020-07-25 19:06:38
【问题描述】:

我有以下文档条目:

{
    "_id": {
        "$oid": "5f0f876df0127d7d1612139c"
    },
    "stream": [{
        "$numberLong": "1594638000000"
    }, 8213.9, 8224, 8213.8, 8224, 18.1126896],
    "asset": "BTC/EUR",
    "timeframe": "5m",
    "date": {
        "$date": "2020-07-13T11:00:00.000Z"
    },
    "__v": 0
}

无论我如何尝试,当我搜索日期时,我都无法返回此特定条目。

我试过了:

{"date":{"$date":new Date("2020-07-13T10:55:00.000+00:00")}}

{"date":{"$date":ISODate("2020-07-13T10:55:00.000Z")}}

没有成功。

【问题讨论】:

    标签: mongodb mongodb-compass


    【解决方案1】:

    正确的查询是:

    {"date":ISODate("2020-07-13T12:25:00Z")}
    

    Compass 中还有一些令人讨厌的错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-18
      • 1970-01-01
      • 2019-02-06
      • 2015-10-06
      • 2021-07-25
      • 2017-07-23
      • 1970-01-01
      • 2018-12-08
      相关资源
      最近更新 更多