123456789101112131415161718192021222324252627282930 |
- // Code that is only sent to the server.
- // main.js is loaded last:
- // http://docs.meteor.com/#/full/structuringyourapp
- Meteor.startup(function () {
- // Insert a document if there isn't one already.
- if (!Documents.findOne()) {
- Documents.insert({ title: "my new document" });
- }
- });
- // Publish read access to collections.
- // All visible docs.
- Meteor.publish("documents", function () {
- Meteor._debug("Publishing documents");
- return Documents.find({
- $or: [
- { isPrivate: { $ne: true } },
- { owner: this.userId }
- ]
- });
- });
- // Users editing docs.
- Meteor.publish("editingUsers", function () {
- Meteor._debug("Publishing all editingUsers");
- return EditingUsers.find();
- });
|