mongoDB mongoimport upsert -
i'm trying bulk update following
mongoimport -d my_db -c db_collection -upsertfields email ~/desktop/update_list.csv
the csv i'm trying import looks this.
email, full_name stack@overflow.com,stackoverflow mongo@db.com,mongodb
it should check email column query arg , update full name accordingly. however, none imported, encountered errors.
exception:failure parsing json string near: abc@sa abc@sasa.com,abc imported 0 objects encountered 99398 errors
where problem? how should doing it?
your mongoimport command missing --upsert option, needed in combination --upsertfields. try:
mongoimport -d my_db -c db_collection --upsert --upsertfields email ~/desktop/update_list.csv
Comments
Post a Comment