Open enzolutions opened 6 years ago
Looks like is all about timing
I removed two joins and leave only one join and after call the subscribe I traverse the results to attach the extra info, but validating that the subscriptions are ready.
Meteor.subscribe('actions');
const logsSubscribe = Meteor.subscribe('logs');
const actionsTypesSubscribe = Meteor.subscribe('actionTypes');
const data = [];
let actions = Actions.find().fetch();
if(logsSubscribe.ready() && actionsTypesSubscribe.ready()) {
_.each(actions, function (action, name) {
var log = Logs.findOne({_id: action.logId});
var type = ActionTypes.findOne({_id: action.actionTypeId});
data.push({
key: action._id,
date: action.actionDate,
time: action.actionTime,
customer: action.customer.firstname + ' ' + action.customer.lastname,
customerId: action.customer._id,
status: action.status,
type: type.name,
notes: log.notes,
files: log.files
});
});
}
Maybe you could document and include a new feature that warranty that the subscriptions are ready.
Hi @enzolutions! I've used a code very similar to yours...
Actions.join(Customers, "customerId", "customer", ["_id", "firstname","lastname"]);
Actions.join(ActionTypes, "actionTypeId", "type", ["name"]);
.. and it works for me.
Have you tried it with the latest version?
Not really, but I switched to Mongo Aggregations
I am trying to do a query with 2 and more joins, the problem I found is I when I load my router directly works, but when I jump from a router menu doesn't work.
I don't know if is an issue with react-route 2.x or react-router-dom 4.x i tried with both with same behavior.
Here the code I am trying
Maybe onely one join is possible?