LoginSignup
2
1

More than 3 years have passed since last update.

mongodbの時間(ISODate)で〜以上を検索する

Last updated at Posted at 2019-05-09

mongodbでcreatedやmodifiedの時間で「何時以上」と検索したいことがあると思います。

そのような時のクエリは以下のように記述します。

db.bonus_log.find({'created':{'$gte':ISODate("2019-05-08T18:05:23")}})

その他比較演算子は以下のようになります。

sql記述 mongodb記述 解釈
>= $gte 以上
> $gt より大きい
<= $lte 以下
< $lt 未満
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1