Permalink
Browse files

Convert to new publish API.

  • Loading branch information...
1 parent cb14d11 commit f6fffe0d6b90b163e70c395cfd98e3f995e38025 @debergalis debergalis committed Feb 23, 2012
Showing with 10 additions and 22 deletions.
  1. +6 −14 examples/todos/model.js
  2. +2 −5 packages/livedata/livedata_test_service.js
  3. +2 −3 packages/tinytest/tinytest_server.js
View
@@ -2,20 +2,12 @@ Lists = new Meteor.Collection("lists");
Todos = new Meteor.Collection("todos");
-/* Schema support coming soon!
-
-Lists.schema({text: String});
-
-Todos.schema({text: String,
- done: Boolean,
- tags: [String]});
-*/
-
if (Meteor.is_server) {
- Meteor.publish('lists');
- Meteor.publish('todos', {
- selector: function (params) {
- return {list_id: params.list};
- }
+ Meteor.publish('lists', function (sub, params) {
+ return Lists.find();
+ });
+
+ Meteor.publish('todos', function (sub, params) {
+ return Todos.find({list_id: params.list});
});
}
@@ -26,11 +26,8 @@ Meteor.startup(function () {
});
if (Meteor.is_server)
- Meteor.publish('ledger', {
- collection: Ledger,
- selector: function (params) {
- return {world: params.world};
- }
+ Meteor.publish('ledger', function (sub, params) {
+ return Ledger.find({world: params.world});
});
App.methods({
@@ -2,9 +2,8 @@ Meteor.startup(function () {
Meteor._ServerTestResults.remove();
});
-App.publish('tinytest/results', {
- collection: Meteor._ServerTestResults,
- selector: function (params) { return {run_id: params.run_id} }
+App.publish('tinytest/results', function (sub, params) {
+ return Meteor._ServerTestResults.find({run_id: params.run_id});
});
App.methods({

0 comments on commit f6fffe0

Please sign in to comment.