Tuesday, 14 May 2019

[HELP] Running multiple functions in order

Hey,First of all, sorry if you aren't allowed to look for help here; there doesn't seem to be anything about that. Second, I have written a program which is split in to 5 modules, each doing their own task. I'm trying to run these modules from app.js. The problem is, after the first module has done its task (Fetch data from MongoDB), the whole program exits. Here's some of the code from the first module.module.exports = async function() { return new Promise((resolve, reject) => { let mongoOptions = { uri: 'URI', collection: 'COLLECTION', fields: ['FIELD'], output: PATH } mongotocsv.export(mongoOptions, function(err, success) { if (err) { reject(err); return; }; resolve(success); }); }); } I am using "Mongo-to-csv" package to export the data. The package can be found here: https://www.npmjs.com/package/mongo-to-csv​Thanks in advance!

Submitted May 14, 2019 at 09:42PM by Tikkane_

No comments:

Post a Comment