Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Search 如何在MongoDB GORM中搜索日期_Search_Grails_Date_Mongodb - Fatal编程技术网

Search 如何在MongoDB GORM中搜索日期

Search 如何在MongoDB GORM中搜索日期,search,grails,date,mongodb,Search,Grails,Date,Mongodb,我无法在MongoDB GORM中进行简单的MongoDB日期搜索 有办法吗?我也没有在MongoDB GORM中搜索日期。我设法做到了这一点: 导入com.mongodb* 福班{ def方法{ 整数间隔=1*1000*60*60 日期1=新日期 Date date2=new Datedate1.getTime-interval def mongo=新的mongo本地主机 def db=mongo.getDB'database' DBCollection coll=db.getCollecti

我无法在MongoDB GORM中进行简单的MongoDB日期搜索


有办法吗?

我也没有在MongoDB GORM中搜索日期。我设法做到了这一点:

导入com.mongodb* 福班{ def方法{ 整数间隔=1*1000*60*60 日期1=新日期 Date date2=new Datedate1.getTime-interval def mongo=新的mongo本地主机 def db=mongo.getDB'database' DBCollection coll=db.getCollectioncollection DBObject query=QueryBuilder.start.putdateCreated .lessthan相等日期1 .greaterthanequalsdate 2 收到 DBCursor cur=coll.findquery 返回电流长度 } }
Grails生成由。。。芬达尔比。。。对于字段域模型。 假设您有域模型

class Foo {
  Date date
}

Foo.findAllByDateBetween(startDate, endDate)

您应该添加您尝试过的内容、实际失败的内容以及您尝试过的代码。那样我们就能帮你了