Many enhancements in relation with Beanita and Beanie#46
Open
Guibod wants to merge 6 commits intoscottrogowski:masterfrom
Open
Many enhancements in relation with Beanita and Beanie#46Guibod wants to merge 6 commits intoscottrogowski:masterfrom
Guibod wants to merge 6 commits intoscottrogowski:masterfrom
Conversation
Result class are simple subclasses of pymongo classes, mongita emulates the raw response from the server
922789e to
0135d4c
Compare
Contributor
Author
|
@scottrogowski Hello, it’s been a while since my PR is sleeping. I’ve just wanted to check your decision regarding my PR. I know that you hesitated to implement this because there was a regression risk, and that you didn’t have a lot of time to work on this. Nonetheless, it’s important for me to check where mongita is going in order to validate my plans. Thanks for your time :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Beanie is a Pydantic extension that supports asynchronous database operation through
Motor. Its author, Roman Right also created aMongitasubpackage named Beanita that enables async operations inMongitain order to simulateMotor’s behaviour. Roman also applied some extension toMongitainBeanita.Beanie also started to use
find_one_and_update/find_one_and_replaceand such a support is required in Mongita. As a Beanita user, I’d like to port as many things into Mongita so that everybody can benefit from Roman features.In this PR, you will find the following changes:
bson.SONordered dicts, andpymongo.resultsclassCollection.create_indexnow acceptsnameparameter, and usesbson.SONinternally.Collection.create_indexes, that uses a loop over the already implementedCollection.create_indexCollection.drop_indexes, that uses a loop over the already implementedCollection.drop_indexCollection.drop, that is an alias forDatabase.drop_collectionCollection.find_one_and_update(with no support for upsert)Collection.find_one_and_replaceCollection.find_one_and_deleteDatabase.command, only forbuildinfoitemDeleteResult,UpdateResultsupportsraw_resultproperty (used for theupdatedExistingvalue)InsertOneResult,InsertManyResult,DeleteResult,UpdateResultare straight subclasses ofpymongoclasses since I reintroduced theraw_resultproperty support. I’ve hesitated to remove the classes that are now useless but in order to maintain backward compatibility I preferred to maintain them this way._idfield will trigger aMongitaErrorsimilarly to Mongo/PyMongo behavior where the error code 66 is raised if you try to run this:db.test.insertOne({foo: "bar"}); db.test.updateOne({foo: "bar"}, {$set: {_id: ObjectId()}}). This behaviour was required by theCollection.find_one_and_updatemethod to assert that_idis not part of the update.