0.0.1 • Published 6 years ago

monogoose-seed-csv v0.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
6 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},
    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