在 Rails 上比较 MongoID 中的两个参数

Compare two params in MongoID on Rails

我正在尝试使用 MongoID:

在 Rails 中进行这样的查询

"Find Tasks Where Date is less than Done_date and Done_date is between the beginning of this week and the end of this week"

我找到了一种比较 Mongo id 中两个元素的方法:

Tasks.collection.find({"$where" => 'this.date >= this.done_date'})

但我真的不知道如何在其中添加日期范围。

试试这个:

Tasks.where('$where' => 'this.date >= this.done_date')