Try moving projection after sort/limit

Trying to get these queries to be faster
This commit is contained in:
Michael Schmatz 2015-02-20 11:05:58 -05:00
parent ab0ac4342b
commit 5b39c6bb19

View file

@ -160,9 +160,9 @@ module.exports.getTwoGames = (req, res) ->
query = LevelSession
.aggregate()
.match(queryParams)
.project(selection)
.sort({'submitDate': -1})
.limit(sortLimit)
.project(selection)
.skip(humanSkipCount)
.limit(1)
query.exec (err, randomSession) =>
@ -175,9 +175,9 @@ module.exports.getTwoGames = (req, res) ->
query = LevelSession
.aggregate()
.match(queryParams)
.project(selection)
.sort({'submitDate': -1})
.limit(sortLimit)
.project(selection)
.skip(ogresSkipCount)
.limit(1)
query.exec (err, otherSession) =>