@@ -40,6 +40,7 @@ class Cursor:
40
40
"_count" ,
41
41
"_cached" ,
42
42
"_stats" ,
43
+ "_plan" ,
43
44
"_profile" ,
44
45
"_warnings" ,
45
46
"_has_more" ,
@@ -63,6 +64,7 @@ def __init__(
63
64
self ._count : Optional [int ] = None
64
65
self ._cached = None
65
66
self ._stats = None
67
+ self ._plan = None
66
68
self ._profile = None
67
69
self ._warnings = None
68
70
self ._next_batch_id : Optional [str ] = None
@@ -132,12 +134,18 @@ def _update(self, data: Json) -> Json:
132
134
self ._warnings = extra ["warnings" ]
133
135
result ["warnings" ] = extra ["warnings" ]
134
136
137
+ if "plan" in extra :
138
+ self ._plan = extra ["plan" ]
139
+ result ["plan" ] = extra ["plan" ]
140
+
135
141
if "stats" in extra :
136
142
stats = extra ["stats" ]
137
143
if "writesExecuted" in stats :
138
144
stats ["modified" ] = stats .pop ("writesExecuted" )
139
145
if "writesIgnored" in stats :
140
146
stats ["ignored" ] = stats .pop ("writesIgnored" )
147
+ if "documentLookups" in stats :
148
+ stats ["lookups" ] = stats .pop ("documentLookups" )
141
149
if "scannedFull" in stats :
142
150
stats ["scanned_full" ] = stats .pop ("scannedFull" )
143
151
if "scannedIndex" in stats :
@@ -159,6 +167,9 @@ def _update(self, data: Json) -> Json:
159
167
if "peakMemoryUsage" in stats :
160
168
stats ["peak_memory_usage" ] = stats .pop ("peakMemoryUsage" )
161
169
170
+ if "intermediateCommits" in stats :
171
+ stats ["intermediate_commits" ] = stats .pop ("intermediateCommits" )
172
+
162
173
self ._stats = stats
163
174
result ["statistics" ] = stats
164
175
@@ -239,6 +250,14 @@ def warnings(self) -> Optional[Sequence[Json]]:
239
250
"""
240
251
return self ._warnings
241
252
253
+ def plan (self ) -> Optional [Json ]:
254
+ """Return query execution plan.
255
+
256
+ :return: Query execution plan.
257
+ :rtype: dict
258
+ """
259
+ return self ._plan
260
+
242
261
def empty (self ) -> bool :
243
262
"""Check if the current batch is empty.
244
263
0 commit comments