This is collection a:
Martial arts: ["One Yang Finger", "Nine Yin True Scripture", "Sword Spectrum to ward off evil"]
collection b:
Main Skills: "One Yang Finger",
Lethality: "90"
In this way, I received data from the front desk {skill: "dragon claw hand",
Lethality: "80"}
This data is to be inserted into collectionb
You should also update your skills: even the dragon claw hand to the "martial arts" of collection a
Similarly, b is a sub-table of a.
What can make them relate to each other and insert one at a time instead of inserting one table at a time?
Because some fields may be associated with multiple collection. Update by the same token
Sorry, I was wrong. mongo has no such thing as multi-table transactions. You’d better make it into the form of sub-objects in the table.
Python has a bulk_write, and most other languages also have it.
Reqs=[pymongo.DeleteMany (parameters are actually the same as delete functions), pymongo.UpdateOne (parameters are actually the same as update_one), pymongo.Insert (same as above)]database.conns.bulk_write(reqs)