CSV to JSON for MongoDB Import
Quick Answer: Paste CSV data to generate a JSON array compatible with mongoimport --jsonArray. Each CSV row becomes a MongoDB document. Numeric values are preserved as numbers, not strings, for proper MongoDB querying and indexing.
Output will appear here...
FAQ
What is the mongoimport command for JSON?
mongoimport --uri "mongodb://..." --db mydb --collection mycol --jsonArray --file data.json. The --jsonArray flag is required for arrays.
Should I import CSV directly into MongoDB?
mongoimport supports CSV directly: --type csv --headerline. Converting to JSON first gives you more control over data types and nested document structure.