Skip to content

Instantly share code, notes, and snippets.

@yeputons
Created April 14, 2014 11:15
Show Gist options
  • Select an option

  • Save yeputons/10638870 to your computer and use it in GitHub Desktop.

Select an option

Save yeputons/10638870 to your computer and use it in GitHub Desktop.
<head>
<title>reactive-publish-findone</title>
</head>
<body>
{{> serverFacts}}
</body>
Items = new Meteor.Collection('items');
if (Meteor.isClient) {
for (var x = 1; x <= 100; x++)
Meteor.subscribe('test', x);
}
if (Meteor.isServer) {
Meteor.reactivePublish('test', function(x) {
if (x <= 40) {
Items.findOne({x: x}, {reactive: true});
} else {
Items.find({x: x}, {reactive: true}).fetch();
}
return [];
});
Facts.setUserIdFilter(function () {
return true;
});
}
{
"packages": {
"reactive-publish": {}
}
}
{
"meteor": {},
"dependencies": {
"basePackages": {
"reactive-publish": {}
},
"packages": {
"reactive-publish": {
"git": "https://github.com/Diggsey/meteor-reactive-publish.git",
"tag": "v0.1.6",
"commit": "dd8c149f109a1f3d1cac7e36293cf5904538ca90"
},
"server-deps": {
"git": "https://github.com/Diggsey/meteor-server-deps.git",
"tag": "v0.1.2",
"commit": "2db5d15fad9240723549cbbc5260a74b6b7e1c61"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment