我有以下文件:
{
"postId": "Message_2D73B43390041E868694A85A65E47A09D50F019C180E93BAACC454488F67A411_1375457942227",
"userId": "User_2D73B43390041E868694A85A65E47A09D50F019C180E93BAACC454488F67A411",
"post_message": "test",
"attachments": {
"images": [
],
"audio": [
],
"videos": [
]
},
"timestamp": 1375457942227,
"followers": [
],
"follow": 0,
"reporters": [
],
"report": 0,
"rerayz": 0,
"mtype": "post"
}
我想做以下查询:
SELECT * FROM posts WHERE users in ("User_1", "User_2", "User_3") ORDER_BY timestamp LIMIT 20
我做了以下操作,并传递了多个 ?keys=["User_1", "User_2", etc] 。但是我怎样才能得到按时间戳排序的结果,以便只获得第 20 个呢?
function (doc, meta) {
if(doc.mtype == "post") {
emit(doc.userId, doc.post_message);
}
}
有什么建议么?
谢谢。