Skip to content

Instantly share code, notes, and snippets.

@dmackerman
Created March 14, 2014 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmackerman/9546777 to your computer and use it in GitHub Desktop.
Save dmackerman/9546777 to your computer and use it in GitHub Desktop.
// just return the request, to test.
function onRequest(request, response, modules){
// fetch all of our kickstart-tpls
modules.collectionAccess.collection('kickstarts-tpl').find({}, function(err, kickstartTemplates) {
// we need to convert the string to an ObjectId representation??? I've tried it without
// this and it still returns nothing.
var kickstartTemplateId = modules.collectionAccess.objectID(kickstartTemplates[0]._id);
modules.logger.info('kickstart_tpl_id: ' + kickstartTemplateId);
// "kickstart_tpl_id: 53220be7f811291203033885"
modules.collectionAccess.collection('topics-tpl').find({ "kickstart_tpl_id": kickstartTemplateId }, function(err, topicTemplates) {
response.body = topicTemplates; // [ ]
response.complete(200);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment