Skip to content

Instantly share code, notes, and snippets.

@Phil-Factor
Created March 4, 2019 17:56
It is probably easier to use the old Windows command line to try out CSV Data import with headers
Set csvfile=%appdata%\addresses.csv
Set MongoImport=%programFiles%\MongoDB\Server\4.0\bin\mongoimport.exe
chcp 65001
echo Name.string(),Address.string(),City.string(),State.string(),ZIP.string(),InsertionDate.date_ms(yyyy-MM-dd H:mm:ss)>%csvfile%
echo Andy Capp,123 High St,Jacksonville,CA,90213,2012-05-31 12:00:00>>%csvfile%
echo Bowler Hatt,243 New Road,New York,NY,10860,2011-07-03 18:00:00>>%csvfile%
"%mongoimport%" -d 'Sample' -c 'Addresses' --type csv --file %appdata%\addresses.csv --headerline –columnsHaveTypes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment