problem description
how do I insert an array into Collection? If item_id exists, do not insert?
for example:
item_arr = [
{"item_id": "1",
"title" : "AAA"
},
{"item_id": "2",
"title" : "BBB"
}
]
I would like to ask how to insert item_arr into Collection. If there is a record item_id = 1, only the record item_id = 2 is inserted.
the environmental background of the problems and what methods you have tried
1.pymongoupdate_one upsert = true
2.update_manyupsert ?
3.insert_manyupsert