diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-01-23 14:53:46 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-01-23 14:53:46 +0900 |
| commit | b82eda5046119213e2a4adb8a46babd61bde50f8 (patch) | |
| tree | e6f5170345af454fa486f786d369fbf3b2eb01ab /src/api | |
| parent | [Client] Fix bug (diff) | |
| download | sharkey-b82eda5046119213e2a4adb8a46babd61bde50f8.tar.gz sharkey-b82eda5046119213e2a4adb8a46babd61bde50f8.tar.bz2 sharkey-b82eda5046119213e2a4adb8a46babd61bde50f8.zip | |
[Server] Fix query performance
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/endpoints/drive/folders.js | 4 | ||||
| -rw-r--r-- | src/api/endpoints/messaging/messages.js | 4 | ||||
| -rw-r--r-- | src/api/endpoints/my/apps.js | 2 | ||||
| -rw-r--r-- | src/api/endpoints/posts.js | 4 | ||||
| -rw-r--r-- | src/api/endpoints/posts/reposts.js | 4 | ||||
| -rw-r--r-- | src/api/endpoints/users.js | 4 |
6 files changed, 11 insertions, 11 deletions
diff --git a/src/api/endpoints/drive/folders.js b/src/api/endpoints/drive/folders.js index fd37840ff7..f233de25a1 100644 --- a/src/api/endpoints/drive/folders.js +++ b/src/api/endpoints/drive/folders.js @@ -49,14 +49,14 @@ module.exports = (params, user, app) => // Construct query const sort = { - created_at: -1 + _id: -1 }; const query = { user_id: user._id, parent_id: folder }; if (since !== null) { - sort.created_at = 1; + sort._id = 1; query._id = { $gt: new mongo.ObjectID(since) }; diff --git a/src/api/endpoints/messaging/messages.js b/src/api/endpoints/messaging/messages.js index 9440e2b3aa..387ed3bea1 100644 --- a/src/api/endpoints/messaging/messages.js +++ b/src/api/endpoints/messaging/messages.js @@ -74,11 +74,11 @@ module.exports = (params, user) => }; const sort = { - created_at: -1 + _id: -1 }; if (since !== null) { - sort.created_at = 1; + sort._id = 1; query._id = { $gt: new mongo.ObjectID(since) }; diff --git a/src/api/endpoints/my/apps.js b/src/api/endpoints/my/apps.js index 3745a92e0f..818c636949 100644 --- a/src/api/endpoints/my/apps.js +++ b/src/api/endpoints/my/apps.js @@ -48,7 +48,7 @@ module.exports = (params, user) => limit: limit, skip: offset, sort: { - created_at: -1 + _id: -1 } }); diff --git a/src/api/endpoints/posts.js b/src/api/endpoints/posts.js index 0428b400bc..9bc25315a7 100644 --- a/src/api/endpoints/posts.js +++ b/src/api/endpoints/posts.js @@ -38,11 +38,11 @@ module.exports = (params) => // Construct query const sort = { - created_at: -1 + _id: -1 }; const query = {}; if (since !== null) { - sort.created_at = 1; + sort._id = 1; query._id = { $gt: new mongo.ObjectID(since) }; diff --git a/src/api/endpoints/posts/reposts.js b/src/api/endpoints/posts/reposts.js index a118ca6fba..ed97a601e3 100644 --- a/src/api/endpoints/posts/reposts.js +++ b/src/api/endpoints/posts/reposts.js @@ -55,13 +55,13 @@ module.exports = (params, user) => // Construct query const sort = { - created_at: -1 + _id: -1 }; const query = { repost_id: post._id }; if (since !== null) { - sort.created_at = 1; + sort._id = 1; query._id = { $gt: new mongo.ObjectID(since) }; diff --git a/src/api/endpoints/users.js b/src/api/endpoints/users.js index 1c6024e3ee..671eaae14f 100644 --- a/src/api/endpoints/users.js +++ b/src/api/endpoints/users.js @@ -39,11 +39,11 @@ module.exports = (params, me) => // Construct query const sort = { - created_at: -1 + _id: -1 }; const query = {}; if (since !== null) { - sort.created_at = 1; + sort._id = 1; query._id = { $gt: new mongo.ObjectID(since) }; |