首页 > 解决方案 > 如果日期在 mongodb 中为 ISODate 格式,如何使用 $gte 和 <e mongo 运算符

问题描述

db.claimPaymentLog.find({"claimDate":{"$lte":{"sec":1579046400,"usec":0}}})

{"claimDate":{"$lte":{"sec":1579046400,"usec":0}}在数据库中有 claimDate 字段。现在我想在字符串格式的 claimDate 字段上执行$gte和操作,如下所示:&lte

我的代码:

  $start = new MongoDate(strtotime("2020-01-15 00:00:00"));
  $this->_collection->find({"claimDate":{"$lte":$start}});

标签: mongodbmongodb-query

解决方案


推荐阅读