monogoose-seed-csv

0.0.1 • Public • Published

mongoose-seed-csv

mongoose-seed-csv is a wrapper for mongoose-seed that will parse data from csv files

Usage

const seeder = require('mongoose-seed-csv');
seeder.populateFromCSV(
    [
        './test/location.csv',
        {path: './test/map.csv', model: 'Map', parseOptions: {columns: true}}
    ],
    {columns: true},
    function(){
        seeder.disconnect();
    });

Methods

seeder.populateFromCSV(csvEntryArray, [csvParseOptions], [callback])

CSV_EntryObject

/**
 * @typedef {object} CSV_Entry
 * @property {string} path - csv file path
 * @property {string} [model] - model name
 * @property {string} [parseOptions] - individual parse option (it will override csvParseOption)
 */

Dependencies

Package Sidebar

Install

npm i monogoose-seed-csv

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

5.02 kB

Total Files

4

Last publish

Collaborators

  • noizbuster