0.0.4 • Published 5 years ago

mongoose-seed-csv v0.0.4

Weekly downloads
8
License
MIT
Repository
github
Last release
5 years ago

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, parseDeep: 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