Reputation: 667
I've been reading about MongoDB and realize i can insert a new document with insert_one() or with update_one(upsert = True).
since I manage my own ids, it is easier for me to query by a specific id and create the doc if not exist, without the need to handle 2 different methods (create and update).
Queries should be very fast in MongoDB, so what do i trade for this convenience?
Upvotes: 1
Views: 981
Reputation: 83
Actually, you trade nothing. You should use insert_one()
only for explicit creation of objects.
Upvotes: 1