CSV (Comma Separated Values) format is intentionally simple and does not have support for comments. You'll have to pre-filter your commented lines before passing through to mongoimport
.
mongoimport
is intended to be used from a command-line, but you've mentioned you are talking to MongoDB from a Node.js app.
Rather than invoking mongoimport
, I would recommend using a node.js csv module. You can then easily do your own line-based filtering for comments or other format deviations, and insert using the MongoDB driver directly.