Unable to Use Mongo Export Query
mongodb
Solution
`mongoexport` must be run from your OS command shell, not the mongo shell.
Problem
I have a collecton named "sample" and database named "at" present in Mongo DB . ``` db.sample.find().pretty() { "_id" : "35004", "city" : "ACMAR", "pop" : 6055, "state" : "AL" } { "_id" : "35005", "city" : "ADAMSVILLE", "pop" : 10616, "state" : "AL" } { "_id" : "35006", "city" : "ADGER", "pop" : 3205, "state" : "AL" } ``` I have tried using mongo export query , but i was unsuccessful , please let me know where i am doing mistake . I have tried using below ways , but always produced an error . ``` mongoexport --host localhost --db at --collection "sample" --csv --out text.csv --fields city,state mongoexport --csv -o /D:/test.csv -d at -c sample -f city,state,pop ``` I was getting the following error , please help Sun Mar 10 00:25:44 SyntaxError: missing ; before statement (shell):1