Abacn commented on code in PR #22400:
URL: https://github.com/apache/beam/pull/22400#discussion_r983992315


##########
sdks/python/apache_beam/io/mongodbio.py:
##########
@@ -732,13 +750,18 @@ def process(self, element, *args, **kwargs):
       # distributed across too many processes. See more on the ObjectId format
       # https://docs.mongodb.com/manual/reference/bson-types/#objectid.
       element["_id"] = objectid.ObjectId()
-
     yield element
 
 
 class _WriteMongoFn(DoFn):
   def __init__(
-      self, uri=None, db=None, coll=None, batch_size=100, extra_params=None):
+      self,
+      uri=None,
+      db=None,
+      coll=None,
+      batch_size=100,
+      extra_params=None,
+      writeFn=None):

Review Comment:
   We can define the typehint of write_func argument as Optional[Union[str, 
Callable]]. If it is None or "ReplaceOne" then set write_func= 
_ReplaceOneWriteFunc; if it is "UpdateOne" then set write_func= 
_UpdateOneWriteFunc, and document this behavior.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to