Search 如何在MongoDB GORM中搜索日期
我无法在MongoDB GORM中进行简单的MongoDB日期搜索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中搜索日期。我设法做到了这一点: 导入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)
您应该添加您尝试过的内容、实际失败的内容以及您尝试过的代码。那样我们就能帮你了