Refty / mongo-thingy

:leaves: Powerful schema-less ODM for MongoDB and Python (sync + async)
https://mongo-thingy.readthedocs.io
MIT License
68 stars 12 forks source link

Implement a create method #10

Closed Shir0kamii closed 6 years ago

Shir0kamii commented 6 years ago

A create method would be fine when you want to be sure the document will be inserted and not upserted as with the save method.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 336a7a43536f2d28163939188526827060135739 on feature/create into 9bd68a8c3a6b1b515aaf8d159e8d54bd79733ac0 on master.

ramnes commented 6 years ago

:+1:

ramnes commented 6 years ago

After thinking a bit more about it, I replaced it with a force_insert parameter for save, that has the exact same purpose (see 453f2d62f28fbfb645e510b928dd540d34b3b04e). I don't like the idea of having two different semantics that can potentially do the same thing, and I don't want to distinguish the two functionally neither because it would make the API harder to understand without any gain.