sql >> Database teknologi >  >> NoSQL >> MongoDB

Brug af Async med MongoDb til at udfylde samlingsdokumenter i rækkefølge

din insertRowInBLD funktion skal returnere et Promise instans i stedet for undefined som nu. Async.series sendes et array af undefined .

Dette.

function fillBLD() {
    async.series(
        [
            insertRowInBLD('R01', 'Disclosure of data due to deliberate action by internal actor', 'E. Not significant', 'Partially effective', 'Low', '', '', '', ''),
            insertRowInBLD('R02', 'Corruption of data due to deliberate action by internal actor', 'E. Not significant', 'Partially effective', 'Low', '', '', '', ''),
            insertRowInBLD('R03', 'Unavailability of data due to deliberate action by internal actor', 'E. Not significant', 'Partially effective', '', '', '', '', ''),
            insertRowInBLD('R04', 'Disclosure of data due to attack of the communications link by internal/external actor', 'E. Not significant', 'Partially effective', 'Low', '', '', '', ''),
            insertRowInBLD('R05', 'Corruption of data due to attack of the communications link by internal/external actor', 'E. Not significant', 'Partially effective', 'Low', '', '', '', ''),
        ]
    );
}
 

er faktisk dette.

function fillBLD() { async.series( [ undefined, undefined, undefined, undefined, undefined ] ); }


  1. MongoError:getaddriinfo ENOTFOUND undefined undefined:27017

  2. Fjernelse af hvide mellemrum (førende og efterfølgende) fra strengværdi

  3. Spring Data MongoDB hvordan man tildeler udløbstid programmatisk

  4. C# - MongoDB - Opdater et element i et indlejret dokument