I have the following document:
{
"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"
}
I would like do the following query:
SELECT * FROM posts WHERE users in ("User_1", "User_2", "User_3") ORDER_BY timestamp LIMIT 20
I did the following and I pass multiple ?keys=[“User_1”, “User_2”, etc] . But how can I get the results sorted by timestamp in order to get only the 20 first?
function (doc, meta) {
if(doc.mtype == "post") {
emit(doc.userId, doc.post_message);
}
}
Any suggestions?
Thanks.