Angularjs 如何在RESTAPI中按日期查询
我正在使用环回生成RESTAPI,并拥有一个包含学生出勤记录的出勤表。下面的查询给出了下面给出的结果 结果:Angularjs 如何在RESTAPI中按日期查询,angularjs,rest,loopbackjs,strongloop,Angularjs,Rest,Loopbackjs,Strongloop,我正在使用环回生成RESTAPI,并拥有一个包含学生出勤记录的出勤表。下面的查询给出了下面给出的结果 结果: [ { "regno": "1414", "name": "Salman", "reason": "on leave", "class": "R", "date": "2015-08-27T05:26:33.000Z", "status": true, "id": 1 } ] 但是我想通过这样的查询得到相同的结果 i、
[
{
"regno": "1414",
"name": "Salman",
"reason": "on leave",
"class": "R",
"date": "2015-08-27T05:26:33.000Z",
"status": true,
"id": 1
}
]
但是我想通过这样的查询得到相同的结果
i、 时间不应该是必需的。。或者认为它是未知的实体。如何获得与上述相同的结果?目前环回不支持类似的功能。请随意打开一个问题,但这对我来说适用于postgresql:
http://localhost:3000/api/Attendances?filter[where][start][between][0]=2015-08-29&filter[where][start][between][1]=2015-08-29T23:59:59.999Z
您还可以重写find方法来为您执行此操作
var originalFind = Attendance.find;
Attendance.find = function(filter) {
if (filter && filter.where && filter.where.date) {
// check if the date and convert the filter if needed.
}
return originalFind.apply(this, arguments);
};