Importing json documents into mongodb on mac - json

I am getting an error while importing a json document into mongoDB installed on my mac. I saw on another forum that the syntax is as follows:
mongoimport --db db1 --collection collection1 --file /Users/chummi/Desktop/zips.json
Here db1 is my database and collection1 is my collection and /Users/chummi/Desktop/zips.json is the path where the json document is present. When I run this command, am getting the following error
"SyntaxError: Unexpected identifier"
and not able to understand what this is.Please suggest if the syntax and the paths are correct?

Are you running mongoimport from inside the mongodb shell instead of the command line of your mac? Importing JSON file using mongimport, keep getting `unexpected identifier`?

Related

How to import a Json file into a collection of MongoDB 6.0?

I am new in MongoDB. I don't know how to insert a json file in to a collection in MongoDB 6.0.
I tried this in windows cmd:
mongoimport --uri mongodb://localhost:27017/ --collection --type json --file
But I was facing this error:
Error
I was trying to follow this:
Json to MongoDB
source: https://www.mongodb.com/compatibility/json-to-mongodb
Please help me to solve it.
Have a look at mongoimport Examples
Would be like this:
mongoimport --uri="mongodb://localhost:27017" --collection=xyz --type=json --file="c:\Temp\abcd.json"

MongoDB JSON File not loading

I am trying to load a json file on to my MongoDB. When I try to load it I keep getting this error....
error validating settings: incompatible options: --file and positional argument(s)
What is the problem?

Constructing batch file command line using arguments

I was tried exporting data from SQL Server table to .csv file and for that, I'm using the BCP utility in a batch file. My requirement is to pass database name, filename and server name as arguments.
bcp %1.dbo.temp_raw_MSPsalesrecordExtract out \\192.168.17.95\NonProdData1\CMA\ChennaiDA\Selva\%2.csv -c -t"|" -S "%3" -T
while running got an error
C:\Users\selva\Desktop\Bat>bcp.bat selva_test testfile ind-server01
The input line is too long.
The syntax of the command is incorrect.
Could anyone help me on this?

Mongo multiple JSON file insert error

I am trying to insert multiple JSON documents into mongoDB with:
for (i=0; 1<1000000; i++){ mongoimport -d test -c questions TWDS1E1.txt}
TWDS1E1.txt is our JSON file held locally in C:\Program Files\MongoDB\Server\3.0\bin
But I am getting Unexpected identifier error!
I have also tried db.collections.insert( TWDS1E1.txt ) but getting TWDS1E1 is not defined error
What am I doing wrong and how can I insert multiple documents for the shell?
Mant thanks

Errors during import of sql file to MySQL database

I am new to database and have just started to learn MYSQL. I have downloaded a sql file called rating.sql and would like to import it to the MYSQL database installed on the local machine. The operation system is Windows 7. The path for the sql file is:
"E:\rating.sql".
I am using the following commands in the MySQL Command Line Client
mysql>use database_name;
mysql>source E:\rating.sql;
The system gives the following error message:
ERROR 1049 <42000>: Unknown database 'ating.sql'
It is definitely something related to the path. Can anyone explain how this error is generated?Thanks
You have use \ and this is an escape character (omits the immediate following character. So to fix this you can use \ instead.
mysql>resour E:\\rating.sql;
Mysql recognises \r as an escape for a carriage return character.
To make it simpler, could you rename your file to something beginning with another letter...mustn't be b n r t or z...