Skip to content

Instantly share code, notes, and snippets.

@zalavariandris
Last active January 4, 2016 19:29
Show Gist options
  • Save zalavariandris/8667812 to your computer and use it in GitHub Desktop.
Save zalavariandris/8667812 to your computer and use it in GitHub Desktop.
if Meteor.isServer
Meteor.publish "collection", (limit)->
return collection.find({}, {limit: limit})
if Meteor.isClient
length = 0
Deps.autorun ()->
count = collection.find({}).count()
if length <= count then length++ else length = count
Meteor.subscribe "collection", length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment