我只需要获得上周的帖子。我在文档中找不到示例,对于测试,我使用Query-Engine 演示和以下代码:
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
如何获得此片段中的帖子?