Mongoimport json file update or overwritte ..?

Default behavior says skip if already exists so by default it wont overwrite existing data.

But you can update it using --upsert flag.


--drop flag also can be used along with mongoimport command to overwrite/update the existing data.

--drop


./mongoimport --db Project --collection sample --drop --file   /home/UCSC_rule.json

I gave this solution because i have tried using --upsert flag but i could not see any changes in the existing data instead new instance was created.


For MongoDB v3.x,

--mode=upsert