[Server] Fix query performance
This commit is contained in:
parent
a9a763f8c4
commit
d96762cbac
|
@ -50,13 +50,13 @@ module.exports = (params, user) =>
|
||||||
|
|
||||||
// Construct query
|
// Construct query
|
||||||
const sort = {
|
const sort = {
|
||||||
created_at: -1
|
_id: -1
|
||||||
};
|
};
|
||||||
const query = {
|
const query = {
|
||||||
user_id: user._id
|
user_id: user._id
|
||||||
};
|
};
|
||||||
if (since !== null) {
|
if (since !== null) {
|
||||||
sort.created_at = 1;
|
sort._id = 1;
|
||||||
query._id = {
|
query._id = {
|
||||||
$gt: new mongo.ObjectID(since)
|
$gt: new mongo.ObjectID(since)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue