Page 1 of 1

importing a collection from csv

Posted: Sat Jul 11, 2015 2:04 pm
by Ram7585741

Hi,

I have been trying to import a collection from csv file.

All the number type fields in csv is getting imported as string in the collections.

Is there a workaround for this?

Is there a way to change the datatype of the column in a collection after importing data ?

I cant use json format.
reason - I cant risk my data on online csv to json file conversion sites.

thanks

Ram


importing a collection from csv

Posted: Sat Jul 11, 2015 5:04 pm
by RobertJay

Modelexam - are you sure they're set up in the collection as numbers and not strings? Also, any possibility that values are enclosed in e.g. quotes in the csv file?


importing a collection from csv

Posted: Sat Jul 11, 2015 6:12 pm
by Illya Stepanov

Hi -

Please make sure that your .csv file contains such structure:
pre
"_id:string","acl:object","field:number"
"55a15b9ce4b0a016a272d1ac","","1.0"
"55a15b9de4b0a016a272d1ad","","2.0"
"55a15b9ee4b0a016a272d1ae","","3.0"
/pre


importing a collection from csv

Posted: Sun Jul 12, 2015 4:24 pm
by Ram7585741

Thanks a lot...field:number --- this works now!!