mongoimport
import JSON to mongodb, associate with sofish/log2json to manage nginx logs.
$ npm install mongoimport --save
Usage
Install the package with npm, and bring it to your project.
var mi = ;;
Follow the codes below to create a config object:
var config = fields: // {array} data to importdb: 'name' // {string} name of dbcollection: 'collection' // {string|function} name of collection, or use a function to // return a name, accept one param - [fields] the fields to import // they're optionshost: 'localhost:27017' // {string} [optional] by default is 27017username: 'sofish' // {string} [optional]password: '***' // {string} [optional] {} // {function} [optional];
Test
Simply run npm test
to see what happens.