0

I'm trying to import a large one giga tsv file names bouffe.csv. It is in ̀ mongo.../bin but seems there is a syntax error :

> ./mongoimport -d db_name -c collection_name --type tsv --file bouffe.csv -f --numInsertionWorkers 8 --headerline

2017-12-05T22:11:01.064+0100 E QUERY    [thread1] SyntaxError: expected expression, got '.' @(shell):1:0

I am not able to handle it, I am quite new to this database system.

Here is an overview :

enter image description here

3
  • Do you call that from the terminal command line? mongoimport should not be called from inside the mongo-shell.
    – physi
    Dec 5, 2017 at 22:11
  • @Marine1, You are doing (mongoimport) wrong syntax. Dec 6, 2017 at 5:12
  • @Marine1, It shuld not be './' before mongoimport statement. As you can see it's already shown error in your error statement. Dec 6, 2017 at 5:21

1 Answer 1

0

@Marine1,You mongoimport syntax should be like as mention below example.

mongoimport --db test --collection stuff --type csv C:\data\Employee.csv --headerline

In the above example test is database name, stuff is collection name and Employee.csv is the file which i want to import in MongoDB database through mongo shell. And the Employee.csv file location is C:\data\Employee.csv. In My case it has worked properly.

In your case the syntax should be like that

mongoimport --db databasename --collection collectionname --type csv  locationofbouffe.csv  --headerline

The syntax should be in the above mention format, if you want to import the header of the file then mention --headerline.

Note:- Make sure you are running the above mention script in inside the BIN of MongoDB Server.

Very Important Note : mongoimport would be to import a non-BSON file (such as JSON or CSV) into mongodb.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.