Skip to content

Commit 00f27f3

Browse files
authored
MOTOR-940 Improved Bulk Write API (#300)
1 parent 99cc1b5 commit 00f27f3

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

motor/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class AgnosticClient(AgnosticBaseProperties):
110110
arbiters = ReadOnlyProperty()
111111
close = DelegateMethod()
112112
__hash__ = DelegateMethod()
113+
bulk_write = AsyncRead()
113114
drop_database = AsyncCommand().unwrap("MotorDatabase")
114115
options = ReadOnlyProperty()
115116
get_database = DelegateMethod(doc=docstrings.get_database_doc).wrap(Database)

motor/core.pyi

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ from pymongo.read_concern import ReadConcern
5353
from pymongo.read_preferences import _ServerMode
5454
from pymongo.results import (
5555
BulkWriteResult,
56+
ClientBulkWriteResult,
5657
DeleteResult,
5758
InsertManyResult,
5859
InsertOneResult,
@@ -124,6 +125,17 @@ class AgnosticClient(AgnosticBaseProperties[_DocumentType]):
124125
write_concern: Optional[WriteConcern] = None,
125126
read_concern: Optional[ReadConcern] = None,
126127
) -> AgnosticDatabase[_DocumentType]: ...
128+
async def bulk_write(
129+
self,
130+
models: Sequence[_WriteOp[_DocumentType]],
131+
session: Optional[ClientSession] = None,
132+
ordered: bool = True,
133+
verbose_results: bool = False,
134+
bypass_document_validation: Optional[bool] = None,
135+
comment: Optional[Any] = None,
136+
let: Optional[Mapping] = None,
137+
write_concern: Optional[WriteConcern] = None,
138+
) -> ClientBulkWriteResult: ...
127139

128140
HOST: str
129141

synchro/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
from pymongo.srv_resolver import _resolve, _SrvResolver
104104
from pymongo.ssl_support import *
105105
from pymongo.synchronous.client_session import _TxnState
106+
from pymongo.synchronous.encryption import _Encrypter
106107
from pymongo.synchronous.monitor import *
107108
from pymongo.synchronous.periodic_executor import *
108109
from pymongo.synchronous.periodic_executor import _EXECUTORS

test/tornado_tests/test_motor_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def attrs(klass):
3333

3434
motor_client_only = motor_only.union(["open"])
3535

36-
pymongo_client_only = set(["bulk_write"]).union(pymongo_only)
36+
pymongo_client_only = set([]).union(pymongo_only)
3737

3838
pymongo_database_only = set([]).union(pymongo_only)
3939

0 commit comments

Comments
 (0)