mongodb - Mongoimport to merge/upsert fields -
i'm trying import , merge multiple csvs mongo, documents getting replaced rather merged.
for example, if have one.csv:
key1, first column, second column
and two.csv:
key1, third column
i end with:
key1, first column, second column, third column
but instead i'm getting:
key1,third column
currently i'm using:
mongoimport.exe --ftype csv --file first.csv --fields key,firstcolumn,secondcolumn mongoimport.exe --ftype csv --file second.csv --fields key,thirdcolumn --upsert --upsertfields key1
that's way mongoimport
works. there's existing new feature request merge imports, now, you'll have write own import provide merge behavior.
Comments
Post a Comment