agirbal / umongo

Desktop app to browse and administer your MongoDB cluster
http://www.edgytech.com/umongo/
580 stars 94 forks source link

not able to import CSV file in UMongo #156

Closed kt-hema closed 11 years ago

kt-hema commented 11 years ago

Hi Antoine, Please help me to get below issue resolved

Sample CSV file which i want to Import using UMongo:

Name,Address,City,State,Zip "Jane Doe","123 Main St","Whereverville","CA" "Jimmy Gil","555 Broadway Ave","New York","NY"

Note: I am able to import this CSV file using mongo shell. So I imported this file using shell, exported the same file using UMongo, i did not face any issue while export, but when i am trying to import(without using any template), i am getting below error:

com.mongodb.util.JSONParseException: Name,Address,City,State,Zip"Jane Doe","123 Main St","Whereverville","CA""Jimmy Gil","555 Broadway Ave","New York","NY" ^ at com.mongodb.util.JSONParser.read(JSON.java:272) at com.mongodb.util.JSONParser.parse(JSON.java:166) at com.mongodb.util.JSONParser.parse(JSON.java:145) at com.mongodb.util.JSON.parse(JSON.java:81) at com.mongodb.util.JSON.parse(JSON.java:66) at com.edgytech.umongo.DocumentDeserializer.readObject(DocumentDeserializer.java:189) at com.edgytech.umongo.CollectionPanel$17.doRun(CollectionPanel.java:997) at com.edgytech.umongo.DbJob$1.doInBackground(DbJob.java:81) at javax.swing.SwingWorker$1.call(SwingWorker.java:277) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at javax.swing.SwingWorker.run(SwingWorker.java:316) at com.edgytech.swingfast.ScalableThreadPool$ScalableThreadpoolWorker.run(ScalableThreadPool.java:48) at java.lang.Thread.run(Thread.java:662)

agirbal commented 11 years ago

I need some more details please, can you paste a sample of your csv, and the exception you are getting? thanks

sridharn commented 11 years ago

Looks like it is trying to parse input as JSON even if input type is specified as CSV. com.mongodb.util.JSONParseException: id,b,c,d1,January,Monday,1/1/20112,February,Tuesday,1/2/20113,March,Wednesday,1/3/20114,April,Thursday,1/4/20115,May,Friday,1/5/20116,June,Saturday,1/6/20117,July,Sunday,1/7/20118,August,Monday,1/8/20119,September,Tuesday,1/9/201110,October,Wednesday,1/10/201111,November,Thursday,1/11/201112,December,Friday,1/12/2011 ^ at com.mongodb.util.JSONParser.parse(JSON.java:198) at com.mongodb.util.JSONParser.parse(JSON.java:145) at com.mongodb.util.JSON.parse(JSON.java:81) at com.mongodb.util.JSON.parse(JSON.java:66) at com.edgytech.umongo.DocumentDeserializer.readObject(DocumentDeserializer.java:189) at com.edgytech.umongo.DocumentDeserializer$DocumentIterator.next(DocumentDeserializer.java:108) at com.edgytech.umongo.DocumentDeserializer$DocumentIterator.next(DocumentDeserializer.java:93) at com.edgytech.umongo.DocView$2.doRun(DocView.java:450) at com.edgytech.umongo.DbJob$1.doInBackground(DbJob.java:81) at javax.swing.SwingWorker$1.call(Unknown Source) at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at javax.swing.SwingWorker.run(Unknown Source) at com.edgytech.swingfast.ScalableThreadPool$ScalableThreadpoolWorker.run(ScalableThreadPool.java:48) at java.lang.Thread.run(Unknown Source)

agirbal commented 11 years ago

For strings, make sure you enclose them between double quotes, the same way that mongoexport does with CSV. Alternatively, you can follow the instructions here to import using a template, in which case you shouldnt need quotes: http://edgystuff.tumblr.com/post/52313627261/umongo-1-4-2-released-csv-import-usability

kt-hema commented 11 years ago

Hi Antoine, please help me to resolve below issue #156 from Github, I have mentioned/updated details in the issue, please help me.

Thanks, Hemlata On Jul 19, 2013, at 11:03 AM, Antoine Girbal notifications@github.com wrote:

For strings, make sure you enclose them between double quotes, the same way that mongoexport does with CSV. Alternatively, you can follow the instructions here to import using a template, in which case you shouldnt need quotes: http://edgystuff.tumblr.com/post/52313627261/umongo-1-4-2-released-csv-import-usability

— Reply to this email directly or view it on GitHub.

agirbal commented 11 years ago

I see that it is failing, it should be easy to fix. This will be released in 1.4.3, hopefully within a few days

agirbal commented 11 years ago

if you still need it, version 1.4.3 has much more complete and stable CSV import. Documentation is embedded.