Import CSV with merge option


I’m trying to use mongoimport --merge tool to update an existing collection with a CSV file.

The file looks like :

_id, accountNumber
ObjectId(111111111111), acct_number_001
ObjectId(222222222222), acct_number_002

where ObjectId references an already existing _id in the current collection to be udated, and accountNumber being a new field.

The script is the following :

mongoimport --uri myURI --db=myDB --collection=myCollection --type=csv --headerline  --mode=merge --file=myFile.csv

=> Result : 0 document(s) imported successfully

Doing this in a Windows environment, I tried to adapt the objectId, adding single quotes, double quotes, escape char… like e.g. ObjectId(“111111111111”), but still doesn’ work.

A lot of search in the web seems to say that it’s not possible to deal with already existing objectIds in importing a CSV file (but with JSON yes, which is true as I did it).

Does anyone can either confirm that it is not possible to use mongoimport --merge with a CSV, or give me some hints ?

Many thanks