Created
October 31, 2013 00:22
-
-
Save MaerF0x0/7242600 to your computer and use it in GitHub Desktop.
Meteor publish and approximate SQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Meteor.publish( | |
'scores', | |
function() { | |
return Scores.find( | |
{score:{$gt:100}}, | |
{ | |
fields: {user:1,score:1}, | |
sort:{score:-1}, | |
limit:10, | |
skip:pageNumber*pageSize | |
} | |
); | |
} | |
); | |
// SELECT user, score FROM scores WHERE score > 100 SORT BY SCORE DESC OFFSET X LIMIT 10 |
Meteor.publish(
'scores',
function(pageNumber, pageSize) {
...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you could also show where pageNumber & pageSize get passed in 👍