mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 15:13:08 +02:00
[Server] Fix query performance
This commit is contained in:
parent
18ec136e1a
commit
b82eda5046
6 changed files with 11 additions and 11 deletions
|
@ -49,14 +49,14 @@ module.exports = (params, user, app) =>
|
||||||
|
|
||||||
// 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,
|
||||||
parent_id: folder
|
parent_id: folder
|
||||||
};
|
};
|
||||||
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)
|
||||||
};
|
};
|
||||||
|
|
|
@ -74,11 +74,11 @@ module.exports = (params, user) =>
|
||||||
};
|
};
|
||||||
|
|
||||||
const sort = {
|
const sort = {
|
||||||
created_at: -1
|
_id: -1
|
||||||
};
|
};
|
||||||
|
|
||||||
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)
|
||||||
};
|
};
|
||||||
|
|
|
@ -48,7 +48,7 @@ module.exports = (params, user) =>
|
||||||
limit: limit,
|
limit: limit,
|
||||||
skip: offset,
|
skip: offset,
|
||||||
sort: {
|
sort: {
|
||||||
created_at: -1
|
_id: -1
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -38,11 +38,11 @@ module.exports = (params) =>
|
||||||
|
|
||||||
// Construct query
|
// Construct query
|
||||||
const sort = {
|
const sort = {
|
||||||
created_at: -1
|
_id: -1
|
||||||
};
|
};
|
||||||
const query = {};
|
const query = {};
|
||||||
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)
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,13 +55,13 @@ module.exports = (params, user) =>
|
||||||
|
|
||||||
// Construct query
|
// Construct query
|
||||||
const sort = {
|
const sort = {
|
||||||
created_at: -1
|
_id: -1
|
||||||
};
|
};
|
||||||
const query = {
|
const query = {
|
||||||
repost_id: post._id
|
repost_id: post._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)
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,11 +39,11 @@ module.exports = (params, me) =>
|
||||||
|
|
||||||
// Construct query
|
// Construct query
|
||||||
const sort = {
|
const sort = {
|
||||||
created_at: -1
|
_id: -1
|
||||||
};
|
};
|
||||||
const query = {};
|
const query = {};
|
||||||
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 a new issue