Fix the ._get_db() attribute after a Document.switch_db()
Without this patch, I've got: ``` myobj._get_db() <bound method TopLevelDocumentMetaclass._get_db of <class 'oneflow.core.models.nonrel.Article'>> ``` I need to `myobj._get_db()()` to get the database. I felt this like a bug. regards,
This commit is contained in:
		@@ -400,7 +400,7 @@ class Document(BaseDocument):
 | 
			
		||||
        """
 | 
			
		||||
        with switch_db(self.__class__, db_alias) as cls:
 | 
			
		||||
            collection = cls._get_collection()
 | 
			
		||||
            db = cls._get_db
 | 
			
		||||
            db = cls._get_db()
 | 
			
		||||
        self._get_collection = lambda: collection
 | 
			
		||||
        self._get_db = lambda: db
 | 
			
		||||
        self._collection = collection
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user