【发布时间】:2023-03-24 10:51:01
【问题描述】:
我只需要获取上周的帖子。我在Documentation 中找不到示例,对于测试我使用Query-Engine demo 和此代码:
models = [
title: 'WRONG: Future'
date: new Date("2015-05-23")
,
title: 'Correct 1'
date: new Date("2015-05-22")
,
title: 'Correct 2'
date: new Date("2015-05-20")
,
title: 'WRONG: Old'
date: new Date("2015-05-15")
]
max_date = min_date = new Date("2015-05-22");
min_date.setDate(min_date.getDate() - 7);
result = queryEngine.createCollection(models)
.findAll({
$and: {
date: {
$lte: max_date
},
date: {
$gt: min_date
}
}
}).toJSON()
return result
如何获取此切片中的帖子?
【问题讨论】:
标签: docpad query-engine