I want to import a csv file to the mongodb but it has many fields that I dont need (70). So how can I import fields that i need via mongoimport. Compass has this functionality but I need to do it through mongoimport.
Look at jq it might help you.
An alternative is to mongoimport the whole file into a temporary collection, then write an aggregation to $project the fields you want, then $out the result into the final collection.