How to define delimeter to import mongodb

csv, mongodb, mongoimport

Solution

`mongoimport` supports either JSON, CSV (comma separated values) or TSV (tab separated values). The `|` character is not a valid delimiter for either CSV or TSV, so you will need to change your input files' `|` to `,` or a tab, and specify `--type` accordingly.

Problem

I have a data collection, which is separated by `|` character. I am going to add the data collection to mongodb. So I need to separate data through `|` character. how my mongoimport command looks like? Previously, I'm successfully import csv file through the following command. ``` $ mongoimport -d mydb -c things --type csv --file locations.csv --headerline ```

Original source