# mongoose-seed-csv

> Seed data from *.csv files for Mongoose

Latest version **0.0.4** (published 2019-09-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install mongoose-seed-csv
pnpm add mongoose-seed-csv
yarn add mongoose-seed-csv
bun add mongoose-seed-csv
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2019-09-30 |
| First published | 2018-08-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | noizbuster |
| Maintainers | noizbuster |
| Keywords | mongoose, seed, mongo, mongodb, node, node.js, csv |

## Links

- npm: https://www.npmjs.com/package/mongoose-seed-csv
- Repository: https://github.com/noizbuster/mongoose-seed-csv
- Homepage: https://github.com/noizbuster/mongoose-seed-csv#readme
- Issues: https://github.com/noizbuster/mongoose-seed-csv/issues
- npm.io page: https://npm.io/package/mongoose-seed-csv

## Dependencies (3)

- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [csv-parse](https://npm.io/package/csv-parse.md) ^4.4.7
- [mongoose-seed](https://npm.io/package/mongoose-seed.md) ^0.6.0

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 0.0.4 (latest) — 2019-09-30
- 0.0.3 — 2018-09-03
- 0.0.1 — 2018-08-09

## README

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

## Usage
```javascript
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])
* csvEntryArray: [string(filepath) || CSV_Entry]
    * you can you both filepath and CSV_Entry Object and even mixed
* csvParseOptions
    * see: [options for cvs-parse](https://github.com/adaltas/node-csv-parse)
    * +`parseDeep`: if true, the parser try to parse each value as JSON
* callback
    * same callback as in [mongoose-seed's](https://github.com/seanemmer/mongoose-seed) [populateModels](https://github.com/seanemmer/mongoose-seed/blob/master/README.md#seederpopulatemodelsdataarray-callback)
## CSV_EntryObject
```javascript
/**
 * @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
* [mongoose-seed](https://github.com/seanemmer/mongoose-seed)
* [csv-parse](https://github.com/adaltas/node-csv-parse)

---
_Source: https://npm.io/package/mongoose-seed-csv · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
