Questions tagged [meteor-publications]
110 questions
17
votes
2 answers
Meteor.publish: publish collection which depends on other collection
I have a publish function as follows:
Meteor.publish('tasks', function (name) {
var project = Projects.findOne({name: name});
return Tasks.find({projectId: project._id});
});
Now assume that at some point changes are made to Projects with…

Jeanluca Scaljeri
- 26,343
- 56
- 205
- 333
9
votes
1 answer
ES6 Arrow function is changing the scope of this in Meteor.publish
So I been started using ES6 in Meteor, but apparently if you try to use Meteor.publish syntax with an arrow function, this.userId is undefined, while if you use it with a regular function(){} this.userId works perfectly, Im assuming is a kind of…

ncubica
- 8,169
- 9
- 54
- 72
9
votes
1 answer
How to publish multiple collections in single subscription call in meteor?
I this possible to publish multiple collections in single subscription call? if so please guide me.

Ramesh Murugesan
- 4,727
- 7
- 42
- 67
7
votes
2 answers
Meteor.publish is not a function
I have a publications.js file that ONLY includes
Meteor.publish('org', function(_id){
return Organizations.findOne(_id);
});
When things render I get this in the console:
Uncaught TypeError: Meteor.publish is not a function
What am I missing…

btbJosh
- 305
- 2
- 12
5
votes
1 answer
Meteor 1.3 + React: detect subscription failure?
I have a simple Meteor subscription, and I display a loading message while the data is being loaded. But I don't know how to display error message if subscription failed.
export const MyAwesomeComponent = createContainer(() => {
let sub =…

aedm
- 5,596
- 2
- 32
- 36
4
votes
1 answer
Modify data in Meteor.publish before sending down to client
I have the following use case:
I have a users table in MongoDB on the backend, which is a separate service than the frontend. I use DDP.connect() to connect to this backend service.
Each user has a set of "subjects"
Each subject in the users table…

user2205763
- 1,499
- 2
- 14
- 30
3
votes
1 answer
Is there some way to set just a instace of meteor publish?
I'm trying to implement my own custom ping-pong for my meteor application (meteor has a ping-pong implemented for internal use, but I want to introduce a custom behavior). The only way that I found to send data to a client was by using a publisher,…

Tainan Felipe
- 43
- 5
3
votes
1 answer
Publishing Counts for objects in Meteor
On my server side I have for various objects a publication which basically returns the count. Every different object has a different publication name like this:
Meteor.publish('object1Count', function(...
Meteor.publish('object2Count',…

T. Rossi
- 465
- 1
- 6
- 23
3
votes
1 answer
How should I keep my publication reactive?
I am migrating from a custom user rights management system to Alanning:roles v2.0. I have a very basic structure:
A basic user
Groups of users, each with specific settings. I store them in a "group" collection.
A group admin status for users who…

Billybobbonnet
- 3,156
- 4
- 23
- 49
3
votes
2 answers
Modeling and publishing a follower-based feed with Meteor
I'm working on a simple app where a User can follow other users. Users can star posts. And a user's feed is composed of posts that have been starred by users they follow. Pretty simple actually. However, this all gets complicated in Mongo and…

Chet
- 18,421
- 15
- 69
- 113
3
votes
1 answer
Publication of items where User is in group (Alanning Roles and Publications)
I am using Alanning Roles to maintain a set of groups/roles for the users of my application. When a user creates an "Application", I generate a new role for them as the app_name + UUID, then add that as a group with the roles of Admin to the user…

CodeChimp
- 8,016
- 5
- 41
- 79
3
votes
1 answer
dynamic publications in Meteor based on logged in user's "role"
I would like to have some publications that only return the items a user has access to based on their role. I am using the alanning:roles package to handle the roles.
For instance, I have a publication like:
Meteor.publish('header_fields',…

CodeChimp
- 8,016
- 5
- 41
- 79
2
votes
1 answer
How to prevent Meteor's accounts-base from auto-publishing the email of the current user?
According to Meteor's documentation on the Accounts package:
By default, the current user’s username, emails and profile are published to the client.
Is it possible to prevent Meteor from auto-publishing these fields? I know it's just for the user…

Carl Jakobsson
- 125
- 1
- 7
2
votes
0 answers
Meteor subscriptions changing after closing my latops lid. Why? and how to deal with it?
Ok. I'm using meteor, just meteor, no angular, no ionic. And I've come across some strange behavior: I have a user logged in, and I can log Meteor.user() just fine, it comes back with all the correct properties as per the subscription. However, if I…

Spencer Cornwall
- 289
- 2
- 14
2
votes
1 answer
Meteor publication send custom sanitized error to client in publication
I am not sure if I am just doing something wrong or if this is actually not working. I want to display the original publication error on the client, in case I catched one:
Meteor.publish('somePub', function (args) {
const self = this
try {
…

Jankapunkt
- 8,128
- 4
- 30
- 59