UPDATE: SOLVED. It was just a casing error. Collections.planets => Collections.Planets.
@sungwoncho, thanks very much for this great mantra tool.
I am using it for the first time and have a question.
I’ve started a new app with mantra-CLI using these commands:
mantra create planetsapp
mantra generate publication planets
mantra g collection planets -s collection2
mantra g module planets
mantra g container planets:list_planets
The following works correctly in /client/modules/planets/containers/list_planets.js:
export const composer = ({context}, onData) => {
onData(null, {});
};
I have created a collection for this app called ‘planets’ using MongoBooster, and have imported data into it. I would like to access the contents of this collection from the container ‘list_planets.js’.
Here is my composer code, based on code found in mantra-sample-blog-app-master/client/modules/comments/containers/comment_list.js
export const composer = ({context, clearErrors, planetID}, onData) => {
const {Meteor, Collections} = context();
if (Meteor.subscribe('planets', planetID).ready()) {
const options = {
sort: {createdAt: -1}
};
const comments = Collections.planets.find({planetID}, options).fetch();
onData(null, {planetID});
} else {
onData();
}
};
This code is giving me the following error:
Exception from Tracker recompute function:
TypeError: Cannot read property ‘find’ of undefined
How can I correct this? Thanks very much in advance for any info.