-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix BulkWriter.__init__ bug when it has object_class param input #1107
base: main
Are you sure you want to change the base?
fix BulkWriter.__init__ bug when it has object_class param input #1107
Conversation
the collection name is only used when add_operation is called and doesnt alter anything as long object_class is not none when you commit |
bug appears from the add_operation func. def add_operation(
self,
object_class: Type[Union[Document, UnionDoc]],
operation: _WriteOp,
):
if self.object_class is None:
self.object_class = object_class
self._collection_name = object_class.get_collection_name()
else:
if object_class.get_collection_name() != self._collection_name:
raise ValueError(
"All the operations should be for a same collection name"
)
self.operations.append(operation) under the scenarios i mentioned, initialized BulkWriter has no so that |
oh I see what you means now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
fix bug occur to two scenarios
BulkWriter
directly by BulkWriter.init with object_class parm input.BulkWriter
throughDocument.bulk_writer
and Document has collection.